summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--THREADS.txt5
-rw-r--r--configure.ac8
-rwxr-xr-xcorpus/filter-length.pl8
-rwxr-xr-xcorpus/support/tokenizer.pl2
-rwxr-xr-xcorpus/tokenize-anything.sh7
-rw-r--r--decoder/aligner.cc6
-rw-r--r--decoder/apply_models.h4
-rw-r--r--decoder/bottom_up_parser.h4
-rw-r--r--decoder/csplit.cc1
-rw-r--r--decoder/csplit.h4
-rw-r--r--decoder/decoder.cc2
-rw-r--r--decoder/decoder.h4
-rw-r--r--decoder/earley_composer.h4
-rw-r--r--decoder/factored_lexicon_helper.h4
-rw-r--r--decoder/ff.h4
-rw-r--r--decoder/ff_basic.cc9
-rw-r--r--decoder/ff_basic.h7
-rw-r--r--decoder/ff_bleu.h4
-rw-r--r--decoder/ff_charset.h4
-rw-r--r--decoder/ff_context.h5
-rw-r--r--decoder/ff_csplit.cc8
-rw-r--r--decoder/ff_csplit.h4
-rw-r--r--decoder/ff_external.h4
-rw-r--r--decoder/ff_factory.h4
-rw-r--r--decoder/ff_klm.h4
-rw-r--r--decoder/ff_lm.h4
-rw-r--r--decoder/ff_ngrams.h4
-rw-r--r--decoder/ff_parse_match.h4
-rw-r--r--decoder/ff_rules.h4
-rw-r--r--decoder/ff_ruleshape.h4
-rw-r--r--decoder/ff_soft_syntax.h4
-rw-r--r--decoder/ff_soft_syntax_mindist.h4
-rw-r--r--decoder/ff_source_path.h4
-rw-r--r--decoder/ff_source_syntax.cc7
-rw-r--r--decoder/ff_source_syntax.h4
-rw-r--r--decoder/ff_source_syntax2.cc1
-rw-r--r--decoder/ff_source_syntax2.h4
-rw-r--r--decoder/ff_spans.h4
-rw-r--r--decoder/ff_tagger.h4
-rw-r--r--decoder/ff_wordalign.h4
-rw-r--r--decoder/ff_wordset.h4
-rw-r--r--decoder/ffset.h4
-rw-r--r--decoder/forest_writer.h4
-rw-r--r--decoder/freqdict.h4
-rw-r--r--decoder/fst_translator.cc1
-rw-r--r--decoder/hg.h4
-rw-r--r--decoder/hg_intersect.cc2
-rw-r--r--decoder/hg_intersect.h4
-rw-r--r--decoder/hg_io.h4
-rw-r--r--decoder/hg_remove_eps.h4
-rw-r--r--decoder/hg_sampler.h5
-rw-r--r--decoder/hg_union.h4
-rw-r--r--decoder/incremental.h4
-rw-r--r--decoder/inside_outside.h4
-rw-r--r--decoder/json_parse.h4
-rw-r--r--decoder/kbest.h4
-rw-r--r--decoder/lattice.cc1
-rw-r--r--decoder/lattice.h20
-rw-r--r--decoder/lexalign.cc7
-rw-r--r--decoder/lexalign.h4
-rw-r--r--decoder/lextrans.cc7
-rw-r--r--decoder/lextrans.h4
-rw-r--r--decoder/node_state_hash.h4
-rw-r--r--decoder/phrasebased_translator.cc1
-rw-r--r--decoder/phrasebased_translator.h4
-rw-r--r--decoder/phrasetable_fst.h4
-rw-r--r--decoder/rescore_translator.cc1
-rw-r--r--decoder/rule_lexer.h4
-rw-r--r--decoder/scfg_translator.cc2
-rw-r--r--decoder/sentence_metadata.h27
-rw-r--r--decoder/tagger.cc2
-rw-r--r--decoder/tagger.h4
-rw-r--r--decoder/translator.h4
-rw-r--r--decoder/tree2string_translator.cc12
-rw-r--r--decoder/tree_fragment.cc7
-rw-r--r--decoder/tree_fragment.h2
-rw-r--r--decoder/trule.h4
-rw-r--r--decoder/viterbi.h4
-rw-r--r--extractor/README.md4
-rw-r--r--extractor/sacompile.cc1
-rw-r--r--klm/lm/bhiksha.hh29
-rw-r--r--klm/lm/binary_format.cc2
-rw-r--r--klm/lm/binary_format.hh6
-rw-r--r--klm/lm/blank.hh6
-rw-r--r--klm/lm/builder/Makefile.am8
-rw-r--r--klm/lm/builder/adjust_counts.cc164
-rw-r--r--klm/lm/builder/adjust_counts.hh41
-rw-r--r--klm/lm/builder/adjust_counts_test.cc13
-rw-r--r--klm/lm/builder/corpus_count.cc100
-rw-r--r--klm/lm/builder/corpus_count.hh11
-rw-r--r--klm/lm/builder/corpus_count_test.cc2
-rw-r--r--klm/lm/builder/discount.hh6
-rw-r--r--klm/lm/builder/dump_counts_main.cc36
-rw-r--r--klm/lm/builder/hash_gamma.hh19
-rw-r--r--klm/lm/builder/header_info.hh4
-rw-r--r--klm/lm/builder/initial_probabilities.cc191
-rw-r--r--klm/lm/builder/initial_probabilities.hh17
-rw-r--r--klm/lm/builder/interpolate.cc122
-rw-r--r--klm/lm/builder/interpolate.hh22
-rw-r--r--klm/lm/builder/joint_order.hh10
-rw-r--r--klm/lm/builder/lmplz_main.cc97
-rw-r--r--klm/lm/builder/ngram.hh39
-rw-r--r--klm/lm/builder/ngram_stream.hh9
-rw-r--r--klm/lm/builder/pipeline.cc103
-rw-r--r--klm/lm/builder/pipeline.hh38
-rw-r--r--klm/lm/builder/print.cc12
-rw-r--r--klm/lm/builder/print.hh12
-rw-r--r--klm/lm/builder/sort.hh157
-rw-r--r--klm/lm/config.hh6
-rw-r--r--klm/lm/enumerate_vocab.hh6
-rw-r--r--klm/lm/facade.hh6
-rw-r--r--klm/lm/filter/arpa_io.hh6
-rw-r--r--klm/lm/filter/count_io.hh6
-rw-r--r--klm/lm/filter/format.hh6
-rw-r--r--klm/lm/filter/phrase.hh6
-rw-r--r--klm/lm/filter/thread.hh6
-rw-r--r--klm/lm/filter/vocab.hh6
-rw-r--r--klm/lm/filter/wrapper.hh6
-rw-r--r--klm/lm/interpolate/arpa_to_stream.cc47
-rw-r--r--klm/lm/interpolate/arpa_to_stream.hh38
-rw-r--r--klm/lm/interpolate/example_sort_main.cc144
-rw-r--r--klm/lm/left.hh6
-rw-r--r--klm/lm/lm_exception.hh4
-rw-r--r--klm/lm/max_order.hh8
-rw-r--r--klm/lm/model.hh6
-rw-r--r--klm/lm/model_test.cc2
-rw-r--r--klm/lm/model_type.hh6
-rw-r--r--klm/lm/neural/wordvecs.cc23
-rw-r--r--klm/lm/neural/wordvecs.hh38
-rw-r--r--klm/lm/ngram_query.hh91
-rw-r--r--klm/lm/partial.hh6
-rw-r--r--klm/lm/quantize.hh6
-rw-r--r--klm/lm/query_main.cc75
-rw-r--r--klm/lm/read_arpa.hh31
-rw-r--r--klm/lm/return.hh6
-rw-r--r--klm/lm/search_hashed.cc2
-rw-r--r--klm/lm/search_hashed.hh6
-rw-r--r--klm/lm/search_trie.cc1
-rw-r--r--klm/lm/search_trie.hh6
-rw-r--r--klm/lm/sizes.hh6
-rw-r--r--klm/lm/state.hh6
-rw-r--r--klm/lm/test.arpa2
-rw-r--r--klm/lm/test_nounk.arpa2
-rw-r--r--klm/lm/trie.cc7
-rw-r--r--klm/lm/trie.hh6
-rw-r--r--klm/lm/trie_sort.cc21
-rw-r--r--klm/lm/trie_sort.hh6
-rw-r--r--klm/lm/value.hh6
-rw-r--r--klm/lm/value_build.hh6
-rw-r--r--klm/lm/virtual_interface.hh6
-rw-r--r--klm/lm/vocab.cc12
-rw-r--r--klm/lm/vocab.hh90
-rw-r--r--klm/lm/weights.hh6
-rw-r--r--klm/lm/word_index.hh4
-rw-r--r--klm/lm/wrappers/README3
-rw-r--r--klm/lm/wrappers/nplm.cc90
-rw-r--r--klm/lm/wrappers/nplm.hh83
-rw-r--r--klm/util/Makefile.am18
-rw-r--r--klm/util/bit_packing.hh6
-rw-r--r--klm/util/cat_compressed_main.cc47
-rw-r--r--klm/util/ersatz_progress.hh6
-rw-r--r--klm/util/exception.hh9
-rw-r--r--klm/util/fake_ofstream.hh13
-rw-r--r--klm/util/file.cc142
-rw-r--r--klm/util/file.hh49
-rw-r--r--klm/util/file_piece.cc7
-rw-r--r--klm/util/file_piece.hh29
-rw-r--r--klm/util/fixed_array.hh153
-rw-r--r--klm/util/getopt.hh6
-rw-r--r--klm/util/have.hh6
-rw-r--r--klm/util/joint_sort.hh6
-rw-r--r--klm/util/mmap.cc69
-rw-r--r--klm/util/mmap.hh88
-rw-r--r--klm/util/multi_intersection.hh6
-rw-r--r--klm/util/murmur_hash.hh6
-rw-r--r--klm/util/parallel_read.cc69
-rw-r--r--klm/util/parallel_read.hh16
-rw-r--r--klm/util/pcqueue.hh9
-rw-r--r--klm/util/pool.hh6
-rw-r--r--klm/util/probing_hash_table.hh11
-rw-r--r--klm/util/proxy_iterator.hh6
-rw-r--r--klm/util/read_compressed.cc417
-rw-r--r--klm/util/read_compressed.hh10
-rw-r--r--klm/util/read_compressed_test.cc5
-rw-r--r--klm/util/scoped.cc4
-rw-r--r--klm/util/scoped.hh129
-rw-r--r--klm/util/sized_iterator.hh6
-rw-r--r--klm/util/sorted_uniform.hh27
-rw-r--r--klm/util/stream/Makefile.am1
-rw-r--r--klm/util/stream/block.hh57
-rw-r--r--klm/util/stream/chain.cc12
-rw-r--r--klm/util/stream/chain.hh165
-rw-r--r--klm/util/stream/config.hh43
-rw-r--r--klm/util/stream/io.cc14
-rw-r--r--klm/util/stream/io.hh21
-rw-r--r--klm/util/stream/line_input.hh6
-rw-r--r--klm/util/stream/multi_progress.hh6
-rw-r--r--klm/util/stream/multi_stream.hh127
-rw-r--r--klm/util/stream/sort.hh14
-rw-r--r--klm/util/stream/stream.hh9
-rw-r--r--klm/util/stream/timer.hh6
-rw-r--r--klm/util/string_piece.cc3
-rw-r--r--klm/util/string_piece.hh1
-rw-r--r--klm/util/string_piece_hash.hh6
-rw-r--r--klm/util/thread_pool.hh16
-rw-r--r--klm/util/tokenize_piece.hh16
-rw-r--r--klm/util/unistd.hh22
-rw-r--r--klm/util/usage.cc4
-rw-r--r--klm/util/usage.hh6
-rw-r--r--m4/ax_pthread.m4332
-rw-r--r--m4/boost.m4352
-rw-r--r--mteval/Makefile.am3
-rw-r--r--mteval/aer_scorer.h4
-rw-r--r--mteval/comb_scorer.h4
-rw-r--r--mteval/external_scorer.h4
-rw-r--r--mteval/levenshtein.h29
-rw-r--r--mteval/ns.cc3
-rw-r--r--mteval/ns.h4
-rw-r--r--mteval/ns_cer.cc26
-rw-r--r--mteval/ns_cer.h7
-rw-r--r--mteval/ns_comb.h4
-rw-r--r--mteval/ns_docscorer.h4
-rw-r--r--mteval/ns_ext.h4
-rw-r--r--mteval/ns_ssk.h4
-rw-r--r--mteval/ns_ter.h4
-rw-r--r--mteval/ns_wer.cc35
-rw-r--r--mteval/ns_wer.h20
-rw-r--r--mteval/ter.h4
-rw-r--r--python/cdec/_cdec.cpp21740
-rw-r--r--python/cdec/_cdec.pyx4
-rw-r--r--python/cdec/hypergraph.pxi15
-rw-r--r--python/cdec/sa/_sa.cpp35749
-rw-r--r--python/cdec/sa/_sa.pxd4
-rw-r--r--python/cdec/sa/bilex.pxi11
-rw-r--r--python/cdec/sa/rule.pxi19
-rw-r--r--python/cdec/sa/rulefactory.pxi20
-rw-r--r--training/crf/Makefile.am17
-rw-r--r--training/mira/ada_opt_sm.cc1
-rw-r--r--training/utils/Makefile.am6
-rw-r--r--utils/alias_sampler.h4
-rw-r--r--utils/alignment_io.h4
-rw-r--r--utils/b64tools.h4
-rw-r--r--utils/corpus_tools.h4
-rw-r--r--utils/exp_semiring.h4
-rw-r--r--utils/fast_sparse_vector.h4
-rw-r--r--utils/fdict.h4
-rw-r--r--utils/feature_vector.h4
-rw-r--r--utils/filelib.h4
-rw-r--r--utils/kernel_string_subseq.h4
-rw-r--r--utils/m.h4
-rw-r--r--utils/murmur_hash3.h4
-rw-r--r--utils/perfect_hash.h4
-rw-r--r--utils/prob.h4
-rw-r--r--utils/small_vector.h4
-rw-r--r--utils/sparse_vector.h4
-rw-r--r--utils/star.h4
-rw-r--r--utils/tdict.h4
-rw-r--r--utils/timing_stats.h4
-rw-r--r--utils/verbose.h4
-rw-r--r--utils/weights.cc2
-rw-r--r--utils/weights.h4
-rw-r--r--utils/wordid.h4
263 files changed, 36851 insertions, 26235 deletions
diff --git a/.gitignore b/.gitignore
index 0c785305..6400b1fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+klm/lm/builder/dump_counts
+klm/util/cat_compressed
example_extff/ff_example.lo
example_extff/libff_example.la
mteval/meteor_jar.cc
@@ -225,3 +227,4 @@ training/utils/sentserver
utils/stringlib_test
word-aligner/binderiv
word-aligner/fast_align
+test-driver
diff --git a/THREADS.txt b/THREADS.txt
new file mode 100644
index 00000000..4dba2403
--- /dev/null
+++ b/THREADS.txt
@@ -0,0 +1,5 @@
+The cdec decoder is not, in general, thread safe. There are system components
+that make use of multi-threading, but the decoder may not be used from multiple
+threads. If you wish to decode in parallel, independent decoder processes
+must be run.
+
diff --git a/configure.ac b/configure.ac
index eae2f32e..b8e9ef20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_CONFIG_MACRO_DIR([m4])
-AC_INIT([cdec],[2014-06-15])
+AC_INIT([cdec],[2014-10-12])
AC_CONFIG_SRCDIR([decoder/cdec.cc])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)
@@ -12,9 +12,11 @@ OLD_CXXFLAGS=$CXXFLAGS
AC_PROG_CC
AC_PROG_CXX
CXXFLAGS=$OLD_CXXFLAGS
+AX_PTHREAD
AX_CXX_COMPILE_STDCXX_11([],[mandatory])
AC_LANG_CPLUSPLUS
AC_OPENMP
+AC_CHECK_LIB(rt, clock_gettime)
BOOST_REQUIRE([1.44])
BOOST_FILESYSTEM
BOOST_PROGRAM_OPTIONS
@@ -25,7 +27,6 @@ BOOST_TEST
BOOST_THREADS
AM_PATH_PYTHON
AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
-AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_HEADERS(zlib.h,
AC_CHECK_LIB(z, gzread,[
@@ -54,7 +55,8 @@ AM_CONDITIONAL([MPI], [test "x$mpi" = xyes])
if test "x$mpi" = xyes
then
AC_DEFINE([HAVE_MPI], [1], [flag for MPI])
- LIBS="$LIBS -lboost_mpi"
+ BOOST_MPI
+ #LIBS="$LIBS -lboost_mpi"
fi
AM_CONDITIONAL([HAVE_METEOR], false)
diff --git a/corpus/filter-length.pl b/corpus/filter-length.pl
index 2e257cda..8b73a1c8 100755
--- a/corpus/filter-length.pl
+++ b/corpus/filter-length.pl
@@ -52,8 +52,10 @@ while(<F>) {
}
next;
}
- my @fs = split /\s+/, $sf;
- my @es = split /\s+/, $se;
+ my @fs = ();
+ my @es = ();
+ if (defined $sf && length($sf) > 0) { @fs = split /\s+/, $sf; }
+ if (defined $se && length($se) > 0) { @es = split /\s+/, $se; }
my $flen = scalar @fs;
my $elen = scalar @es;
if ($flen == 0) {
@@ -114,7 +116,7 @@ while(<F>) {
if ($lines % 100000 == 0) { print STDERR " [$lines]\n"; }
elsif ($lines % 2500 == 0) { print STDERR "."; }
my ($sf, $se, @d) = split / \|\|\| /;
- if (scalar @d != 0 or !defined $se) { next; }
+ if (!defined $se) { next; }
my @fs = split /\s+/, $sf;
my @es = split /\s+/, $se;
my $flen = scalar @fs;
diff --git a/corpus/support/tokenizer.pl b/corpus/support/tokenizer.pl
index f57bc87a..aa285be4 100755
--- a/corpus/support/tokenizer.pl
+++ b/corpus/support/tokenizer.pl
@@ -386,7 +386,7 @@ sub deep_proc_token {
}
##### step 1: separate by punct T2 on the boundary
- my $t2 = '\`|\!|\@|\+|\=|\[|\]|\<|\>|\||\(|\)|\{|\}|\?|\"|;';
+ my $t2 = '\`|\!|\@|\+|\=|\[|\]|\<|\>|\||\(|\)|\{|\}|\?|\"|;|●|○';
if($line =~ s/^(($t2)+)/$1 /){
return proc_line($line);
}
diff --git a/corpus/tokenize-anything.sh b/corpus/tokenize-anything.sh
index bca954d1..c580e88b 100755
--- a/corpus/tokenize-anything.sh
+++ b/corpus/tokenize-anything.sh
@@ -7,6 +7,13 @@ if [[ $# == 1 && $1 == '-u' ]] ; then
NORMARGS="--batchline"
SEDFLAGS="-u"
else
+ if [[ $# != 0 ]] ; then
+ echo Usage: `basename $0` [-u] \< file.in \> file.out 1>&2
+ echo 1>&2
+ echo Tokenizes text in a reasonable way in most languages. 1>&2
+ echo 1>&2
+ exit 1
+ fi
NORMARGS=""
SEDFLAGS=""
fi
diff --git a/decoder/aligner.cc b/decoder/aligner.cc
index 232e022a..fd648370 100644
--- a/decoder/aligner.cc
+++ b/decoder/aligner.cc
@@ -198,13 +198,13 @@ void AlignerTools::WriteAlignment(const Lattice& src_lattice,
}
const Hypergraph* g = &in_g;
HypergraphP new_hg;
- if (!src_lattice.IsSentence() ||
- !trg_lattice.IsSentence()) {
+ if (!IsSentence(src_lattice) ||
+ !IsSentence(trg_lattice)) {
if (map_instead_of_viterbi) {
cerr << " Lattice alignment: using Viterbi instead of MAP alignment\n";
}
map_instead_of_viterbi = false;
- fix_up_src_spans = !src_lattice.IsSentence();
+ fix_up_src_spans = !IsSentence(src_lattice);
}
KBest::KBestDerivations<vector<Hypergraph::Edge const*>, ViterbiPathTraversal> kbest(in_g, k_best);
diff --git a/decoder/apply_models.h b/decoder/apply_models.h
index 19a4c7be..f03c973a 100644
--- a/decoder/apply_models.h
+++ b/decoder/apply_models.h
@@ -1,5 +1,5 @@
-#ifndef _APPLY_MODELS_H_
-#define _APPLY_MODELS_H_
+#ifndef APPLY_MODELS_H_
+#define APPLY_MODELS_H_
#include <iostream>
diff --git a/decoder/bottom_up_parser.h b/decoder/bottom_up_parser.h
index 546bfb54..628bb96d 100644
--- a/decoder/bottom_up_parser.h
+++ b/decoder/bottom_up_parser.h
@@ -1,5 +1,5 @@
-#ifndef _BOTTOM_UP_PARSER_H_
-#define _BOTTOM_UP_PARSER_H_
+#ifndef BOTTOM_UP_PARSER_H_
+#define BOTTOM_UP_PARSER_H_
#include <vector>
#include <string>
diff --git a/decoder/csplit.cc b/decoder/csplit.cc
index 4a723822..7ee4092e 100644
--- a/decoder/csplit.cc
+++ b/decoder/csplit.cc
@@ -151,6 +151,7 @@ bool CompoundSplit::TranslateImpl(const string& input,
smeta->SetSourceLength(in.size()); // TODO do utf8 or somethign
for (int i = 0; i < in.size(); ++i)
smeta->src_lattice_.push_back(vector<LatticeArc>(1, LatticeArc(TD::Convert(in[i]), 0.0, 1)));
+ smeta->ComputeInputLatticeType();
pimpl_->BuildTrellis(in, forest);
forest->Reweight(weights);
return true;
diff --git a/decoder/csplit.h b/decoder/csplit.h
index 82ed23fc..83d457b8 100644
--- a/decoder/csplit.h
+++ b/decoder/csplit.h
@@ -1,5 +1,5 @@
-#ifndef _CSPLIT_H_
-#define _CSPLIT_H_
+#ifndef CSPLIT_H_
+#define CSPLIT_H_
#include "translator.h"
#include "lattice.h"
diff --git a/decoder/decoder.cc b/decoder/decoder.cc
index c384c33f..9e8d692a 100644
--- a/decoder/decoder.cc
+++ b/decoder/decoder.cc
@@ -86,7 +86,7 @@ struct ELengthWeightFunction {
}
};
inline void ShowBanner() {
- cerr << "cdec (c) 2009--2014 by Chris Dyer\n";
+ cerr << "cdec (c) 2009--2014 by Chris Dyer" << endl;
}
inline string str(char const* name,po::variables_map const& conf) {
diff --git a/decoder/decoder.h b/decoder/decoder.h
index 8039a42b..a545206b 100644
--- a/decoder/decoder.h
+++ b/decoder/decoder.h
@@ -1,5 +1,5 @@
-#ifndef _DECODER_H_
-#define _DECODER_H_
+#ifndef DECODER_H_
+#define DECODER_H_
#include <iostream>
#include <string>
diff --git a/decoder/earley_composer.h b/decoder/earley_composer.h
index 9f786bf6..31602f67 100644
--- a/decoder/earley_composer.h
+++ b/decoder/earley_composer.h
@@ -1,5 +1,5 @@
-#ifndef _EARLEY_COMPOSER_H_
-#define _EARLEY_COMPOSER_H_
+#ifndef EARLEY_COMPOSER_H_
+#define EARLEY_COMPOSER_H_
#include <iostream>
diff --git a/decoder/factored_lexicon_helper.h b/decoder/factored_lexicon_helper.h
index 7fedc517..460bdebb 100644
--- a/decoder/factored_lexicon_helper.h
+++ b/decoder/factored_lexicon_helper.h
@@ -1,5 +1,5 @@
-#ifndef _FACTORED_LEXICON_HELPER_
-#define _FACTORED_LEXICON_HELPER_
+#ifndef FACTORED_LEXICON_HELPER_
+#define FACTORED_LEXICON_HELPER_
#include <cassert>
#include <vector>
diff --git a/decoder/ff.h b/decoder/ff.h
index 3280592e..eed1e3fb 100644
--- a/decoder/ff.h
+++ b/decoder/ff.h
@@ -1,5 +1,5 @@
-#ifndef _FF_H_
-#define _FF_H_
+#ifndef FF_H_
+#define FF_H_
#include <string>
#include <vector>
diff --git a/decoder/ff_basic.cc b/decoder/ff_basic.cc
index f9404d24..f960418a 100644
--- a/decoder/ff_basic.cc
+++ b/decoder/ff_basic.cc
@@ -49,9 +49,7 @@ void SourceWordPenalty::TraversalFeaturesImpl(const SentenceMetadata& smeta,
features->set_value(fid_, edge.rule_->FWords() * value_);
}
-
-ArityPenalty::ArityPenalty(const std::string& param) :
- value_(-1.0 / log(10)) {
+ArityPenalty::ArityPenalty(const std::string& param) {
string fname = "Arity_";
unsigned MAX=DEFAULT_MAX_ARITY;
using namespace boost;
@@ -61,7 +59,8 @@ ArityPenalty::ArityPenalty(const std::string& param) :
WordID fid=FD::Convert(fname+lexical_cast<string>(i));
fids_.push_back(fid);
}
- while (!fids_.empty() && fids_.back()==0) fids_.pop_back(); // pretty up features vector in case FD was frozen. doesn't change anything
+ // pretty up features vector in case FD was frozen. doesn't change anything
+ while (!fids_.empty() && fids_.back()==0) fids_.pop_back();
}
void ArityPenalty::TraversalFeaturesImpl(const SentenceMetadata& smeta,
@@ -75,6 +74,6 @@ void ArityPenalty::TraversalFeaturesImpl(const SentenceMetadata& smeta,
(void) state;
(void) estimated_features;
unsigned a=edge.Arity();
- features->set_value(a<fids_.size()?fids_[a]:0, value_);
+ if (a < fids_.size()) features->set_value(fids_[a], 1.0);
}
diff --git a/decoder/ff_basic.h b/decoder/ff_basic.h
index 901c0110..c63daf0f 100644
--- a/decoder/ff_basic.h
+++ b/decoder/ff_basic.h
@@ -1,5 +1,5 @@
-#ifndef _FF_BASIC_H_
-#define _FF_BASIC_H_
+#ifndef FF_BASIC_H_
+#define FF_BASIC_H_
#include "ff.h"
@@ -41,7 +41,7 @@ class SourceWordPenalty : public FeatureFunction {
const double value_;
};
-#define DEFAULT_MAX_ARITY 9
+#define DEFAULT_MAX_ARITY 50
#define DEFAULT_MAX_ARITY_STRINGIZE(x) #x
#define DEFAULT_MAX_ARITY_STRINGIZE_EVAL(x) DEFAULT_MAX_ARITY_STRINGIZE(x)
#define DEFAULT_MAX_ARITY_STR DEFAULT_MAX_ARITY_STRINGIZE_EVAL(DEFAULT_MAX_ARITY)
@@ -62,7 +62,6 @@ class ArityPenalty : public FeatureFunction {
void* context) const;
private:
std::vector<WordID> fids_;
- const double value_;
};
#endif
diff --git a/decoder/ff_bleu.h b/decoder/ff_bleu.h
index 344dc788..8ca2c095 100644
--- a/decoder/ff_bleu.h
+++ b/decoder/ff_bleu.h
@@ -1,5 +1,5 @@
-#ifndef _BLEU_FF_H_
-#define _BLEU_FF_H_
+#ifndef BLEU_FF_H_
+#define BLEU_FF_H_
#include <vector>
#include <string>
diff --git a/decoder/ff_charset.h b/decoder/ff_charset.h
index 267ef65d..e22ece2b 100644
--- a/decoder/ff_charset.h
+++ b/decoder/ff_charset.h
@@ -1,5 +1,5 @@
-#ifndef _FFCHARSET_H_
-#define _FFCHARSET_H_
+#ifndef FFCHARSET_H_
+#define FFCHARSET_H_
#include <string>
#include <map>
diff --git a/decoder/ff_context.h b/decoder/ff_context.h
index 19198ec3..ed1aea2b 100644
--- a/decoder/ff_context.h
+++ b/decoder/ff_context.h
@@ -1,6 +1,5 @@
-
-#ifndef _FF_CONTEXT_H_
-#define _FF_CONTEXT_H_
+#ifndef FF_CONTEXT_H_
+#define FF_CONTEXT_H_
#include <vector>
#include <boost/xpressive/xpressive.hpp>
diff --git a/decoder/ff_csplit.cc b/decoder/ff_csplit.cc
index a0e538d3..550ff69a 100644
--- a/decoder/ff_csplit.cc
+++ b/decoder/ff_csplit.cc
@@ -2,6 +2,8 @@
#include <set>
#include <cstring>
+#include <unordered_set>
+#include <unordered_map>
#include "klm/lm/model.hh"
@@ -14,12 +16,6 @@
#include "stringlib.h"
#include "tdict.h"
-#ifndef HAVE_OLD_CPP
-# include <unordered_set>
-#else
-# include <tr1/unordered_set>
-namespace std { using std::tr1::unordered_set; }
-#endif
using namespace std;
struct BasicCSplitFeaturesImpl {
diff --git a/decoder/ff_csplit.h b/decoder/ff_csplit.h
index 79bf2886..227f2a14 100644
--- a/decoder/ff_csplit.h
+++ b/decoder/ff_csplit.h
@@ -1,5 +1,5 @@
-#ifndef _FF_CSPLIT_H_
-#define _FF_CSPLIT_H_
+#ifndef FF_CSPLIT_H_
+#define FF_CSPLIT_H_
#include <boost/shared_ptr.hpp>
diff --git a/decoder/ff_external.h b/decoder/ff_external.h
index 3e2bee51..fd12a37c 100644
--- a/decoder/ff_external.h
+++ b/decoder/ff_external.h
@@ -1,5 +1,5 @@
-#ifndef _FFEXTERNAL_H_
-#define _FFEXTERNAL_H_
+#ifndef FFEXTERNAL_H_
+#define FFEXTERNAL_H_
#include "ff.h"
diff --git a/decoder/ff_factory.h b/decoder/ff_factory.h
index 1aa8e55f..ba9be9ac 100644
--- a/decoder/ff_factory.h
+++ b/decoder/ff_factory.h
@@ -1,5 +1,5 @@
-#ifndef _FF_FACTORY_H_
-#define _FF_FACTORY_H_
+#ifndef FF_FACTORY_H_
+#define FF_FACTORY_H_
//TODO: use http://www.boost.org/doc/libs/1_43_0/libs/functional/factory/doc/html/index.html ?
diff --git a/decoder/ff_klm.h b/decoder/ff_klm.h
index db4032f7..c8350623 100644
--- a/decoder/ff_klm.h
+++ b/decoder/ff_klm.h
@@ -1,5 +1,5 @@
-#ifndef _KLM_FF_H_
-#define _KLM_FF_H_
+#ifndef KLM_FF_H_
+#define KLM_FF_H_
#include <vector>
#include <string>
diff --git a/decoder/ff_lm.h b/decoder/ff_lm.h
index 85e79704..83a2e186 100644
--- a/decoder/ff_lm.h
+++ b/decoder/ff_lm.h
@@ -1,5 +1,5 @@
-#ifndef _LM_FF_H_
-#define _LM_FF_H_
+#ifndef LM_FF_H_
+#define LM_FF_H_
#include <vector>
#include <string>
diff --git a/decoder/ff_ngrams.h b/decoder/ff_ngrams.h
index 4965d235..5dea9a7d 100644
--- a/decoder/ff_ngrams.h
+++ b/decoder/ff_ngrams.h
@@ -1,5 +1,5 @@
-#ifndef _NGRAMS_FF_H_
-#define _NGRAMS_FF_H_
+#ifndef NGRAMS_FF_H_
+#define NGRAMS_FF_H_
#include <vector>
#include <map>
diff --git a/decoder/ff_parse_match.h b/decoder/ff_parse_match.h
index 7820b418..188c406a 100644
--- a/decoder/ff_parse_match.h
+++ b/decoder/ff_parse_match.h
@@ -1,5 +1,5 @@
-#ifndef _FF_PARSE_MATCH_H_
-#define _FF_PARSE_MATCH_H_
+#ifndef FF_PARSE_MATCH_H_
+#define FF_PARSE_MATCH_H_
#include "ff.h"
#include "hg.h"
diff --git a/decoder/ff_rules.h b/decoder/ff_rules.h
index f210dc65..5c4cf45e 100644
--- a/decoder/ff_rules.h
+++ b/decoder/ff_rules.h
@@ -1,5 +1,5 @@
-#ifndef _FF_RULES_H_
-#define _FF_RULES_H_
+#ifndef FF_RULES_H_
+#define FF_RULES_H_
#include <vector>
#include <map>
diff --git a/decoder/ff_ruleshape.h b/decoder/ff_ruleshape.h
index 488cfd84..66914f5d 100644
--- a/decoder/ff_ruleshape.h
+++ b/decoder/ff_ruleshape.h
@@ -1,5 +1,5 @@
-#ifndef _FF_RULESHAPE_H_
-#define _FF_RULESHAPE_H_
+#ifndef FF_RULESHAPE_H_
+#define FF_RULESHAPE_H_
#include <vector>
#include <map>
diff --git a/decoder/ff_soft_syntax.h b/decoder/ff_soft_syntax.h
index e71825d5..da51df7f 100644
--- a/decoder/ff_soft_syntax.h
+++ b/decoder/ff_soft_syntax.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SOFT_SYNTAX_H_
-#define _FF_SOFT_SYNTAX_H_
+#ifndef FF_SOFT_SYNTAX_H_
+#define FF_SOFT_SYNTAX_H_
#include "ff.h"
#include "hg.h"
diff --git a/decoder/ff_soft_syntax_mindist.h b/decoder/ff_soft_syntax_mindist.h
index bf938b38..205eff4b 100644
--- a/decoder/ff_soft_syntax_mindist.h
+++ b/decoder/ff_soft_syntax_mindist.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SOFT_SYNTAX_MINDIST_H_
-#define _FF_SOFT_SYNTAX_MINDIST_H_
+#ifndef FF_SOFT_SYNTAX_MINDIST_H_
+#define FF_SOFT_SYNTAX_MINDIST_H_
#include "ff.h"
#include "hg.h"
diff --git a/decoder/ff_source_path.h b/decoder/ff_source_path.h
index 03126412..fc309264 100644
--- a/decoder/ff_source_path.h
+++ b/decoder/ff_source_path.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SOURCE_PATH_H_
-#define _FF_SOURCE_PATH_H_
+#ifndef FF_SOURCE_PATH_H_
+#define FF_SOURCE_PATH_H_
#include <vector>
#include <map>
diff --git a/decoder/ff_source_syntax.cc b/decoder/ff_source_syntax.cc
index 6b183863..f6f673d2 100644
--- a/decoder/ff_source_syntax.cc
+++ b/decoder/ff_source_syntax.cc
@@ -2,12 +2,7 @@
#include <sstream>
#include <stack>
-#ifndef HAVE_OLD_CPP
-# include <unordered_set>
-#else
-# include <tr1/unordered_set>
-namespace std { using std::tr1::unordered_set; }
-#endif
+#include <unordered_set>
#include "sentence_metadata.h"
#include "array2d.h"
diff --git a/decoder/ff_source_syntax.h b/decoder/ff_source_syntax.h
index bdd638c1..6316e881 100644
--- a/decoder/ff_source_syntax.h
+++ b/decoder/ff_source_syntax.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SOURCE_SYNTAX_H_
-#define _FF_SOURCE_SYNTAX_H_
+#ifndef FF_SOURCE_SYNTAX_H_
+#define FF_SOURCE_SYNTAX_H_
#include "ff.h"
#include "hg.h"
diff --git a/decoder/ff_source_syntax2.cc b/decoder/ff_source_syntax2.cc
index a97e31d8..48991920 100644
--- a/decoder/ff_source_syntax2.cc
+++ b/decoder/ff_source_syntax2.cc
@@ -3,6 +3,7 @@
#include <sstream>
#include <stack>
#include <string>
+#include <unordered_set>
#include "sentence_metadata.h"
#include "array2d.h"
diff --git a/decoder/ff_source_syntax2.h b/decoder/ff_source_syntax2.h
index f606c2bf..bbfa9eb6 100644
--- a/decoder/ff_source_syntax2.h
+++ b/decoder/ff_source_syntax2.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SOURCE_SYNTAX2_H_
-#define _FF_SOURCE_SYNTAX2_H_
+#ifndef FF_SOURCE_SYNTAX2_H_
+#define FF_SOURCE_SYNTAX2_H_
#include "ff.h"
#include "hg.h"
diff --git a/decoder/ff_spans.h b/decoder/ff_spans.h
index d2f5e84c..e2475491 100644
--- a/decoder/ff_spans.h
+++ b/decoder/ff_spans.h
@@ -1,5 +1,5 @@
-#ifndef _FF_SPANS_H_
-#define _FF_SPANS_H_
+#ifndef FF_SPANS_H_
+#define FF_SPANS_H_
#include <vector>
#include <map>
diff --git a/decoder/ff_tagger.h b/decoder/ff_tagger.h
index 46418b0c..0cb8c648 100644
--- a/decoder/ff_tagger.h
+++ b/decoder/ff_tagger.h
@@ -1,5 +1,5 @@
-#ifndef _FF_TAGGER_H_
-#define _FF_TAGGER_H_
+#ifndef FF_TAGGER_H_
+#define FF_TAGGER_H_
#include <map>
#include <boost/scoped_ptr.hpp>
diff --git a/decoder/ff_wordalign.h b/decoder/ff_wordalign.h
index 0161f603..ec454621 100644
--- a/decoder/ff_wordalign.h
+++ b/decoder/ff_wordalign.h
@@ -1,5 +1,5 @@
-#ifndef _FF_WORD_ALIGN_H_
-#define _FF_WORD_ALIGN_H_
+#ifndef FF_WORD_ALIGN_H_
+#define FF_WORD_ALIGN_H_
#include "ff.h"
#include "array2d.h"
diff --git a/decoder/ff_wordset.h b/decoder/ff_wordset.h
index e78cd2fb..94f5ff8a 100644
--- a/decoder/ff_wordset.h
+++ b/decoder/ff_wordset.h
@@ -1,5 +1,5 @@
-#ifndef _FF_WORDSET_H_
-#define _FF_WORDSET_H_
+#ifndef FF_WORDSET_H_
+#define FF_WORDSET_H_
#include "ff.h"
#include "tdict.h"
diff --git a/decoder/ffset.h b/decoder/ffset.h
index 28aef667..b7322ee2 100644
--- a/decoder/ffset.h
+++ b/decoder/ffset.h
@@ -1,5 +1,5 @@
-#ifndef _FFSET_H_
-#define _FFSET_H_
+#ifndef FFSET_H_
+#define FFSET_H_
#include <vector>
#include "value_array.h"
diff --git a/decoder/forest_writer.h b/decoder/forest_writer.h
index 819a8940..4d28de77 100644
--- a/decoder/forest_writer.h
+++ b/decoder/forest_writer.h
@@ -1,5 +1,5 @@
-#ifndef _FOREST_WRITER_H_
-#define _FOREST_WRITER_H_
+#ifndef FOREST_WRITER_H_
+#define FOREST_WRITER_H_
#include <string>
diff --git a/decoder/freqdict.h b/decoder/freqdict.h
index 4e03fadd..07d797e2 100644
--- a/decoder/freqdict.h
+++ b/decoder/freqdict.h
@@ -1,5 +1,5 @@
-#ifndef _FREQDICT_H_
-#define _FREQDICT_H_
+#ifndef FREQDICT_H_
+#define FREQDICT_H_
#include <iostream>
#include <map>
diff --git a/decoder/fst_translator.cc b/decoder/fst_translator.cc
index 4253b652..50e6adcc 100644
--- a/decoder/fst_translator.cc
+++ b/decoder/fst_translator.cc
@@ -95,6 +95,7 @@ bool FSTTranslator::TranslateImpl(const string& input,
const vector<double>& weights,
Hypergraph* minus_lm_forest) {
smeta->SetSourceLength(0); // don't know how to compute this
+ smeta->input_type_ = cdec::kFOREST;
return pimpl_->Translate(input, weights, minus_lm_forest);
}
diff --git a/decoder/hg.h b/decoder/hg.h
index 4ed27d87..256f650f 100644
--- a/decoder/hg.h
+++ b/decoder/hg.h
@@ -1,5 +1,5 @@
-#ifndef _HG_H_
-#define _HG_H_
+#ifndef HG_H_
+#define HG_H_
// define USE_INFO_EDGE 1 if you want lots of debug info shown with --show_derivations - otherwise it adds quite a bit of overhead if ffs have their logging enabled (e.g. ff_from_fsa)
#ifndef USE_INFO_EDGE
diff --git a/decoder/hg_intersect.cc b/decoder/hg_intersect.cc
index 02f5a401..b9381d02 100644
--- a/decoder/hg_intersect.cc
+++ b/decoder/hg_intersect.cc
@@ -88,7 +88,7 @@ namespace HG {
bool Intersect(const Lattice& target, Hypergraph* hg) {
// there are a number of faster algorithms available for restricted
// classes of hypergraph and/or target.
- if (hg->IsLinearChain() && target.IsSentence())
+ if (hg->IsLinearChain() && IsSentence(target))
return FastLinearIntersect(target, hg);
vector<bool> rem(hg->edges_.size(), false);
diff --git a/decoder/hg_intersect.h b/decoder/hg_intersect.h
index 29a5ea2a..19c1c177 100644
--- a/decoder/hg_intersect.h
+++ b/decoder/hg_intersect.h
@@ -1,5 +1,5 @@
-#ifndef _HG_INTERSECT_H_
-#define _HG_INTERSECT_H_
+#ifndef HG_INTERSECT_H_
+#define HG_INTERSECT_H_
#include "lattice.h"
diff --git a/decoder/hg_io.h b/decoder/hg_io.h
index 58af8132..5a2bd808 100644
--- a/decoder/hg_io.h
+++ b/decoder/hg_io.h
@@ -1,5 +1,5 @@
-#ifndef _HG_IO_H_
-#define _HG_IO_H_
+#ifndef HG_IO_H_
+#define HG_IO_H_
#include <iostream>
#include <string>
diff --git a/decoder/hg_remove_eps.h b/decoder/hg_remove_eps.h
index 82f06039..f67fe6e2 100644
--- a/decoder/hg_remove_eps.h
+++ b/decoder/hg_remove_eps.h
@@ -1,5 +1,5 @@
-#ifndef _HG_REMOVE_EPS_H_
-#define _HG_REMOVE_EPS_H_
+#ifndef HG_REMOVE_EPS_H_
+#define HG_REMOVE_EPS_H_
#include "wordid.h"
class Hypergraph;
diff --git a/decoder/hg_sampler.h b/decoder/hg_sampler.h
index 6ac39a20..4267b5ec 100644
--- a/decoder/hg_sampler.h
+++ b/decoder/hg_sampler.h
@@ -1,6 +1,5 @@
-#ifndef _HG_SAMPLER_H_
-#define _HG_SAMPLER_H_
-
+#ifndef HG_SAMPLER_H_
+#define HG_SAMPLER_H_
#include <vector>
#include <string>
diff --git a/decoder/hg_union.h b/decoder/hg_union.h
index 34624246..bb7e2d09 100644
--- a/decoder/hg_union.h
+++ b/decoder/hg_union.h
@@ -1,5 +1,5 @@
-#ifndef _HG_UNION_H_
-#define _HG_UNION_H_
+#ifndef HG_UNION_H_
+#define HG_UNION_H_
class Hypergraph;
namespace HG {
diff --git a/decoder/incremental.h b/decoder/incremental.h
index f791a626..46b4817b 100644
--- a/decoder/incremental.h
+++ b/decoder/incremental.h
@@ -1,5 +1,5 @@
-#ifndef _INCREMENTAL_H_
-#define _INCREMENTAL_H_
+#ifndef INCREMENTAL_H_
+#define INCREMENTAL_H_
#include "weights.h"
#include <vector>
diff --git a/decoder/inside_outside.h b/decoder/inside_outside.h
index c0377fe8..d5bda63c 100644
--- a/decoder/inside_outside.h
+++ b/decoder/inside_outside.h
@@ -1,5 +1,5 @@
-#ifndef _INSIDE_OUTSIDE_H_
-#define _INSIDE_OUTSIDE_H_
+#ifndef INSIDE_OUTSIDE_H_
+#define INSIDE_OUTSIDE_H_
#include <vector>
#include <algorithm>
diff --git a/decoder/json_parse.h b/decoder/json_parse.h
index c3cba954..85e2eff1 100644
--- a/decoder/json_parse.h
+++ b/decoder/json_parse.h
@@ -1,5 +1,5 @@
-#ifndef _JSON_WRAPPER_H_
-#define _JSON_WRAPPER_H_
+#ifndef JSON_WRAPPER_H_
+#define JSON_WRAPPER_H_
#include <iostream>
#include <cassert>
diff --git a/decoder/kbest.h b/decoder/kbest.h
index c7194c7e..d6b3eb94 100644
--- a/decoder/kbest.h
+++ b/decoder/kbest.h
@@ -1,5 +1,5 @@
-#ifndef _HG_KBEST_H_
-#define _HG_KBEST_H_
+#ifndef HG_KBEST_H_
+#define HG_KBEST_H_
#include <vector>
#include <utility>
diff --git a/decoder/lattice.cc b/decoder/lattice.cc
index 89da3cd0..1f97048d 100644
--- a/decoder/lattice.cc
+++ b/decoder/lattice.cc
@@ -50,7 +50,6 @@ void LatticeTools::ConvertTextToLattice(const string& text, Lattice* pl) {
l.resize(ids.size());
for (int i = 0; i < l.size(); ++i)
l[i].push_back(LatticeArc(ids[i], 0.0, 1));
- l.is_sentence_ = true;
}
void LatticeTools::ConvertTextOrPLF(const string& text_or_plf, Lattice* pl) {
diff --git a/decoder/lattice.h b/decoder/lattice.h
index ad4ca50d..1258d3f5 100644
--- a/decoder/lattice.h
+++ b/decoder/lattice.h
@@ -1,5 +1,5 @@
-#ifndef __LATTICE_H_
-#define __LATTICE_H_
+#ifndef LATTICE_H_
+#define LATTICE_H_
#include <string>
#include <vector>
@@ -25,22 +25,24 @@ class Lattice : public std::vector<std::vector<LatticeArc> > {
friend void LatticeTools::ConvertTextOrPLF(const std::string& text_or_plf, Lattice* pl);
friend void LatticeTools::ConvertTextToLattice(const std::string& text, Lattice* pl);
public:
- Lattice() : is_sentence_(false) {}
+ Lattice() {}
explicit Lattice(size_t t, const std::vector<LatticeArc>& v = std::vector<LatticeArc>()) :
- std::vector<std::vector<LatticeArc> >(t, v),
- is_sentence_(false) {}
+ std::vector<std::vector<LatticeArc>>(t, v) {}
int Distance(int from, int to) const {
if (dist_.empty())
return (to - from);
return dist_(from, to);
}
- // TODO this should actually be computed based on the contents
- // of the lattice
- bool IsSentence() const { return is_sentence_; }
private:
void ComputeDistances();
Array2D<int> dist_;
- bool is_sentence_;
};
+inline bool IsSentence(const Lattice& in) {
+ bool res = true;
+ for (auto& alt : in)
+ if (alt.size() > 1) { res = false; break; }
+ return res;
+}
+
#endif
diff --git a/decoder/lexalign.cc b/decoder/lexalign.cc
index 11f20de7..dd529311 100644
--- a/decoder/lexalign.cc
+++ b/decoder/lexalign.cc
@@ -114,10 +114,9 @@ bool LexicalAlign::TranslateImpl(const string& input,
Hypergraph* forest) {
Lattice& lattice = smeta->src_lattice_;
LatticeTools::ConvertTextOrPLF(input, &lattice);
- if (!lattice.IsSentence()) {
- // lexical models make independence assumptions
- // that don't work with lattices or conf nets
- cerr << "LexicalTrans: cannot deal with lattice source input!\n";
+ smeta->ComputeInputLatticeType();
+ if (smeta->GetInputType() != cdec::kSEQUENCE) {
+ cerr << "LexicalTrans: cannot deal with non-sequence input!";
abort();
}
smeta->SetSourceLength(lattice.size());
diff --git a/decoder/lexalign.h b/decoder/lexalign.h
index 7ba4fe64..6415f4f9 100644
--- a/decoder/lexalign.h
+++ b/decoder/lexalign.h
@@ -1,5 +1,5 @@
-#ifndef _LEXALIGN_H_
-#define _LEXALIGN_H_
+#ifndef LEXALIGN_H_
+#define LEXALIGN_H_
#include "translator.h"
#include "lattice.h"
diff --git a/decoder/lextrans.cc b/decoder/lextrans.cc
index 74a18c3f..d13a891a 100644
--- a/decoder/lextrans.cc
+++ b/decoder/lextrans.cc
@@ -271,10 +271,9 @@ bool LexicalTrans::TranslateImpl(const string& input,
Hypergraph* forest) {
Lattice& lattice = smeta->src_lattice_;
LatticeTools::ConvertTextOrPLF(input, &lattice);
- if (!lattice.IsSentence()) {
- // lexical models make independence assumptions
- // that don't work with lattices or conf nets
- cerr << "LexicalTrans: cannot deal with lattice source input!\n";
+ smeta->ComputeInputLatticeType();
+ if (smeta->GetInputType() != cdec::kSEQUENCE) {
+ cerr << "LexicalTrans: cannot deal with non-sequence inputs\n";
abort();
}
smeta->SetSourceLength(lattice.size());
diff --git a/decoder/lextrans.h b/decoder/lextrans.h
index 2d51e7c0..a23a4e0d 100644
--- a/decoder/lextrans.h
+++ b/decoder/lextrans.h
@@ -1,5 +1,5 @@
-#ifndef _LEXTrans_H_
-#define _LEXTrans_H_
+#ifndef LEXTrans_H_
+#define LEXTrans_H_
#include "translator.h"
#include "lattice.h"
diff --git a/decoder/node_state_hash.h b/decoder/node_state_hash.h
index 9fc01a09..f380fcb1 100644
--- a/decoder/node_state_hash.h
+++ b/decoder/node_state_hash.h
@@ -1,5 +1,5 @@
-#ifndef _NODE_STATE_HASH_
-#define _NODE_STATE_HASH_
+#ifndef NODE_STATE_HASH_
+#define NODE_STATE_HASH_
#include <cassert>
#include <cstring>
diff --git a/decoder/phrasebased_translator.cc b/decoder/phrasebased_translator.cc
index 8048248e..8415353a 100644
--- a/decoder/phrasebased_translator.cc
+++ b/decoder/phrasebased_translator.cc
@@ -114,6 +114,7 @@ struct PhraseBasedTranslatorImpl {
Lattice lattice;
LatticeTools::ConvertTextOrPLF(input, &lattice);
smeta->SetSourceLength(lattice.size());
+ smeta->ComputeInputLatticeType();
size_t est_nodes = lattice.size() * lattice.size() * (1 << max_distortion);
minus_lm_forest->ReserveNodes(est_nodes, est_nodes * 100);
if (add_pass_through_rules) {
diff --git a/decoder/phrasebased_translator.h b/decoder/phrasebased_translator.h
index e5e3f8a2..10790d0d 100644
--- a/decoder/phrasebased_translator.h
+++ b/decoder/phrasebased_translator.h
@@ -1,5 +1,5 @@
-#ifndef _PHRASEBASED_TRANSLATOR_H_
-#define _PHRASEBASED_TRANSLATOR_H_
+#ifndef PHRASEBASED_TRANSLATOR_H_
+#define PHRASEBASED_TRANSLATOR_H_
#include "translator.h"
diff --git a/decoder/phrasetable_fst.h b/decoder/phrasetable_fst.h
index 477de1f7..966bb14d 100644
--- a/decoder/phrasetable_fst.h
+++ b/decoder/phrasetable_fst.h
@@ -1,5 +1,5 @@
-#ifndef _PHRASETABLE_FST_H_
-#define _PHRASETABLE_FST_H_
+#ifndef PHRASETABLE_FST_H_
+#define PHRASETABLE_FST_H_
#include <vector>
#include <string>
diff --git a/decoder/rescore_translator.cc b/decoder/rescore_translator.cc
index 10192f7a..18c83c56 100644
--- a/decoder/rescore_translator.cc
+++ b/decoder/rescore_translator.cc
@@ -53,6 +53,7 @@ bool RescoreTranslator::TranslateImpl(const string& input,
const vector<double>& weights,
Hypergraph* minus_lm_forest) {
smeta->SetSourceLength(0); // don't know how to compute this
+ smeta->input_type_ = cdec::kFOREST;
return pimpl_->Translate(input, weights, minus_lm_forest);
}
diff --git a/decoder/rule_lexer.h b/decoder/rule_lexer.h
index e15c056d..5267f9ca 100644
--- a/decoder/rule_lexer.h
+++ b/decoder/rule_lexer.h
@@ -1,5 +1,5 @@
-#ifndef _RULE_LEXER_H_
-#define _RULE_LEXER_H_
+#ifndef RULE_LEXER_H_
+#define RULE_LEXER_H_
#include <iostream>
#include <string>
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc
index c3cfcaad..538f82ec 100644
--- a/decoder/scfg_translator.cc
+++ b/decoder/scfg_translator.cc
@@ -1,5 +1,6 @@
#include <algorithm>
#include <vector>
+#include <unordered_set>
#include <boost/foreach.hpp>
#include <boost/functional/hash.hpp>
#include "fast_lexical_cast.hpp"
@@ -194,6 +195,7 @@ struct SCFGTranslatorImpl {
Lattice& lattice = smeta->src_lattice_;
LatticeTools::ConvertTextOrPLF(input, &lattice);
smeta->SetSourceLength(lattice.size());
+ smeta->ComputeInputLatticeType();
if (add_pass_through_rules){
if (!SILENT) cerr << "Adding pass through grammar" << endl;
PassThroughGrammar* g = new PassThroughGrammar(lattice, default_nt, ctf_iterations_, num_pt_features);
diff --git a/decoder/sentence_metadata.h b/decoder/sentence_metadata.h
index f2a779f4..e13c2ca5 100644
--- a/decoder/sentence_metadata.h
+++ b/decoder/sentence_metadata.h
@@ -1,14 +1,20 @@
-#ifndef _SENTENCE_METADATA_H_
-#define _SENTENCE_METADATA_H_
+#ifndef SENTENCE_METADATA_H_
+#define SENTENCE_METADATA_H_
#include <string>
#include <map>
#include <cassert>
#include "lattice.h"
+#include "tree_fragment.h"
struct DocScorer; // deprecated, will be removed
struct Score; // deprecated, will be removed
+namespace cdec {
+enum InputType { kSEQUENCE, kTREE, kLATTICE, kFOREST, kUNKNOWN };
+class TreeFragment;
+}
+
class SentenceMetadata {
public:
friend class DecoderImpl;
@@ -17,7 +23,17 @@ class SentenceMetadata {
src_len_(-1),
has_reference_(ref.size() > 0),
trg_len_(ref.size()),
- ref_(has_reference_ ? &ref : NULL) {}
+ ref_(has_reference_ ? &ref : NULL),
+ input_type_(cdec::kUNKNOWN) {}
+
+ // helper function for lattice inputs
+ void ComputeInputLatticeType() {
+ input_type_ = cdec::kSEQUENCE;
+ for (auto& alt : src_lattice_) {
+ if (alt.size() > 1) { input_type_ = cdec::kLATTICE; break; }
+ }
+ }
+ cdec::InputType GetInputType() const { return input_type_; }
int GetSentenceId() const { return sent_id_; }
@@ -25,6 +41,8 @@ class SentenceMetadata {
// it has parsed the source
void SetSourceLength(int sl) { src_len_ = sl; }
+ const cdec::TreeFragment& GetSourceTree() const { return src_tree_; }
+
// this should be called if a separate model needs to
// specify how long the target sentence should be
void SetTargetLength(int tl) {
@@ -64,12 +82,15 @@ class SentenceMetadata {
const Score* app_score;
public:
Lattice src_lattice_; // this will only be set if inputs are finite state!
+ cdec::TreeFragment src_tree_; // this will be set only if inputs are trees
private:
// you need to be very careful when depending on these values
// they will only be set during training / alignment contexts
const bool has_reference_;
int trg_len_;
const Lattice* const ref_;
+ public:
+ cdec::InputType input_type_;
};
#endif
diff --git a/decoder/tagger.cc b/decoder/tagger.cc
index 30fb055f..500d2061 100644
--- a/decoder/tagger.cc
+++ b/decoder/tagger.cc
@@ -100,6 +100,8 @@ bool Tagger::TranslateImpl(const string& input,
Lattice& lattice = smeta->src_lattice_;
LatticeTools::ConvertTextToLattice(input, &lattice);
smeta->SetSourceLength(lattice.size());
+ smeta->ComputeInputLatticeType();
+ assert(smeta->GetInputType() == cdec::kSEQUENCE);
vector<WordID> sequence(lattice.size());
for (int i = 0; i < lattice.size(); ++i) {
assert(lattice[i].size() == 1);
diff --git a/decoder/tagger.h b/decoder/tagger.h
index 9ac820d9..51659d5b 100644
--- a/decoder/tagger.h
+++ b/decoder/tagger.h
@@ -1,5 +1,5 @@
-#ifndef _TAGGER_H_
-#define _TAGGER_H_
+#ifndef TAGGER_H_
+#define TAGGER_H_
#include "translator.h"
diff --git a/decoder/translator.h b/decoder/translator.h
index ba218a0b..096cf191 100644
--- a/decoder/translator.h
+++ b/decoder/translator.h
@@ -1,5 +1,5 @@
-#ifndef _TRANSLATOR_H_
-#define _TRANSLATOR_H_
+#ifndef TRANSLATOR_H_
+#define TRANSLATOR_H_
#include <string>
#include <vector>
diff --git a/decoder/tree2string_translator.cc b/decoder/tree2string_translator.cc
index adc8dc89..08dae64c 100644
--- a/decoder/tree2string_translator.cc
+++ b/decoder/tree2string_translator.cc
@@ -2,6 +2,7 @@
#include <vector>
#include <queue>
#include <map>
+#include <unordered_map>
#include <unordered_set>
#include <boost/shared_ptr.hpp>
#include <boost/functional/hash.hpp>
@@ -31,12 +32,12 @@ static void ReadTree2StringGrammar(istream* in, Tree2StringGrammarNode* root, bo
++lc;
if (line.size() == 0 || line[0] == '#') continue;
std::vector<StringPiece> fields = TokenizeMultisep(line, " ||| ");
- if (has_multiple_states && fields.size() != 4) {
- cerr << "Expected 4 fields in rule file but line " << lc << " is:\n" << line << endl;
+ if (has_multiple_states && fields.size() < 4) {
+ cerr << "Expected at least 4 fields in rule file but line " << lc << " is:\n" << line << endl;
abort();
}
- if (!has_multiple_states && fields.size() != 3) {
- cerr << "Expected 3 fields in rule file but line " << lc << " is:\n" << line << endl;
+ if (!has_multiple_states && fields.size() < 3) {
+ cerr << "Expected at least 3 fields in rule file but line " << lc << " is:\n" << line << endl;
abort();
}
@@ -72,6 +73,7 @@ static void ReadTree2StringGrammar(istream* in, Tree2StringGrammarNode* root, bo
cerr << "Not implemented...\n"; abort(); // TODO read in states
} else {
os << " ||| " << fields[1] << " ||| " << fields[2];
+ if (fields.size() > 3) os << " ||| " << fields[3];
rule.reset(new TRule(os.str()));
}
cur->rules.push_back(rule);
@@ -286,6 +288,8 @@ struct Tree2StringTranslatorImpl {
const vector<double>& weights,
Hypergraph* minus_lm_forest) {
cdec::TreeFragment input_tree(input, false);
+ smeta->src_tree_ = input_tree;
+ smeta->input_type_ = cdec::kTREE;
if (add_pass_through_rules) CreatePassThroughRules(input_tree);
Hypergraph hg;
hg.ReserveNodes(input_tree.nodes.size());
diff --git a/decoder/tree_fragment.cc b/decoder/tree_fragment.cc
index 42f7793a..5f717c5b 100644
--- a/decoder/tree_fragment.cc
+++ b/decoder/tree_fragment.cc
@@ -64,6 +64,13 @@ int TreeFragment::SetupSpansRec(unsigned cur, int left) {
return right;
}
+vector<int> TreeFragment::Terminals() const {
+ vector<int> terms;
+ for (auto& x : *this)
+ if (IsTerminal(x)) terms.push_back(x);
+ return terms;
+}
+
// cp is the character index in the tree
// np keeps track of the nodes (nonterminals) that have been built
// symp keeps track of the terminal symbols that have been built
diff --git a/decoder/tree_fragment.h b/decoder/tree_fragment.h
index 6b4842ee..e19b79fb 100644
--- a/decoder/tree_fragment.h
+++ b/decoder/tree_fragment.h
@@ -72,6 +72,8 @@ class TreeFragment {
BreadthFirstIterator bfs_begin(unsigned node_idx) const;
BreadthFirstIterator bfs_end() const;
+ std::vector<int> Terminals() const;
+
private:
// cp is the character index in the tree
// np keeps track of the nodes (nonterminals) that have been built
diff --git a/decoder/trule.h b/decoder/trule.h
index 243b0da9..adef7cc7 100644
--- a/decoder/trule.h
+++ b/decoder/trule.h
@@ -1,5 +1,5 @@
-#ifndef _RULE_H_
-#define _RULE_H_
+#ifndef TRULE_H_
+#define TRULE_H_
#include <algorithm>
#include <vector>
diff --git a/decoder/viterbi.h b/decoder/viterbi.h
index a8a0ea7f..20ee73cc 100644
--- a/decoder/viterbi.h
+++ b/decoder/viterbi.h
@@ -1,5 +1,5 @@
-#ifndef _VITERBI_H_
-#define _VITERBI_H_
+#ifndef VITERBI_H_
+#define VITERBI_H_
#include <vector>
#include "prob.h"
diff --git a/extractor/README.md b/extractor/README.md
index 642fbd1d..b83ff900 100644
--- a/extractor/README.md
+++ b/extractor/README.md
@@ -1,10 +1,10 @@
-C++ implementation of the online grammar extractor originally developed by [Adam Lopez](http://www.cs.jhu.edu/~alopez/).
+A simple and fast C++ implementation of a SCFG grammar extractor using suffix arrays. The implementation is described in this [paper](https://ufal.mff.cuni.cz/pbml/102/art-baltescu-blunsom.pdf). The original cython extractor is described in [Adam Lopez](http://www.cs.jhu.edu/~alopez/)'s PhD [thesis](http://www.cs.jhu.edu/~alopez/papers/adam.lopez.dissertation.pdf).
The grammar extraction takes place in two steps: (a) precomputing a number of data structures and (b) actually extracting the grammars. All the flags below have the same meaning as in the cython implementation.
To compile the data structures you need to run:
- cdec/extractor/compile -a <alignment> -b <parallel_corpus> -c <compile_config_file> -o <compile_directory>
+ cdec/extractor/sacompile -a <alignment> -b <parallel_corpus> -c <compile_config_file> -o <compile_directory>
To extract the grammars you need to run:
diff --git a/extractor/sacompile.cc b/extractor/sacompile.cc
index 3ee668ce..d80ab64d 100644
--- a/extractor/sacompile.cc
+++ b/extractor/sacompile.cc
@@ -114,6 +114,7 @@ int main(int argc, char** argv) {
stop_write = Clock::now();
write_duration += GetDuration(start_write, stop_write);
+ stop_time = Clock::now();
cerr << "Constructing suffix array took "
<< GetDuration(start_time, stop_time) << " seconds" << endl;
diff --git a/klm/lm/bhiksha.hh b/klm/lm/bhiksha.hh
index 350571a6..134beb2f 100644
--- a/klm/lm/bhiksha.hh
+++ b/klm/lm/bhiksha.hh
@@ -10,17 +10,19 @@
* Currently only used for next pointers.
*/
-#ifndef LM_BHIKSHA__
-#define LM_BHIKSHA__
-
-#include <stdint.h>
-#include <assert.h>
+#ifndef LM_BHIKSHA_H
+#define LM_BHIKSHA_H
#include "lm/model_type.hh"
#include "lm/trie.hh"
#include "util/bit_packing.hh"
#include "util/sorted_uniform.hh"
+#include <algorithm>
+
+#include <stdint.h>
+#include <assert.h>
+
namespace lm {
namespace ngram {
struct Config;
@@ -73,15 +75,24 @@ class ArrayBhiksha {
ArrayBhiksha(void *base, uint64_t max_offset, uint64_t max_value, const Config &config);
void ReadNext(const void *base, uint64_t bit_offset, uint64_t index, uint8_t total_bits, NodeRange &out) const {
- const uint64_t *begin_it = util::BinaryBelow(util::IdentityAccessor<uint64_t>(), offset_begin_, offset_end_, index);
+ // Some assertions are commented out because they are expensive.
+ // assert(*offset_begin_ == 0);
+ // std::upper_bound returns the first element that is greater. Want the
+ // last element that is <= to the index.
+ const uint64_t *begin_it = std::upper_bound(offset_begin_, offset_end_, index) - 1;
+ // Since *offset_begin_ == 0, the position should be in range.
+ // assert(begin_it >= offset_begin_);
const uint64_t *end_it;
- for (end_it = begin_it; (end_it < offset_end_) && (*end_it <= index + 1); ++end_it) {}
+ for (end_it = begin_it + 1; (end_it < offset_end_) && (*end_it <= index + 1); ++end_it) {}
+ // assert(end_it == std::upper_bound(offset_begin_, offset_end_, index + 1));
--end_it;
+ // assert(end_it >= begin_it);
out.begin = ((begin_it - offset_begin_) << next_inline_.bits) |
util::ReadInt57(base, bit_offset, next_inline_.bits, next_inline_.mask);
out.end = ((end_it - offset_begin_) << next_inline_.bits) |
util::ReadInt57(base, bit_offset + total_bits, next_inline_.bits, next_inline_.mask);
- //assert(out.end >= out.begin);
+ // If this fails, consider rebuilding your model using KenLM after 1e333d786b748555e8f368d2bbba29a016c98052
+ assert(out.end >= out.begin);
}
void WriteNext(void *base, uint64_t bit_offset, uint64_t index, uint64_t value) {
@@ -109,4 +120,4 @@ class ArrayBhiksha {
} // namespace ngram
} // namespace lm
-#endif // LM_BHIKSHA__
+#endif // LM_BHIKSHA_H
diff --git a/klm/lm/binary_format.cc b/klm/lm/binary_format.cc
index 9c744b13..48117404 100644
--- a/klm/lm/binary_format.cc
+++ b/klm/lm/binary_format.cc
@@ -149,7 +149,7 @@ void BinaryFormat::InitializeBinary(int fd, ModelType model_type, unsigned int s
void BinaryFormat::ReadForConfig(void *to, std::size_t amount, uint64_t offset_excluding_header) const {
assert(header_size_ != kInvalidSize);
- util::PReadOrThrow(file_.get(), to, amount, offset_excluding_header + header_size_);
+ util::ErsatzPRead(file_.get(), to, amount, offset_excluding_header + header_size_);
}
void *BinaryFormat::LoadBinary(std::size_t size) {
diff --git a/klm/lm/binary_format.hh b/klm/lm/binary_format.hh
index f33f88d7..136d6b1a 100644
--- a/klm/lm/binary_format.hh
+++ b/klm/lm/binary_format.hh
@@ -1,5 +1,5 @@
-#ifndef LM_BINARY_FORMAT__
-#define LM_BINARY_FORMAT__
+#ifndef LM_BINARY_FORMAT_H
+#define LM_BINARY_FORMAT_H
#include "lm/config.hh"
#include "lm/model_type.hh"
@@ -103,4 +103,4 @@ bool IsBinaryFormat(int fd);
} // namespace ngram
} // namespace lm
-#endif // LM_BINARY_FORMAT__
+#endif // LM_BINARY_FORMAT_H
diff --git a/klm/lm/blank.hh b/klm/lm/blank.hh
index 4da81209..94a71ad2 100644
--- a/klm/lm/blank.hh
+++ b/klm/lm/blank.hh
@@ -1,5 +1,5 @@
-#ifndef LM_BLANK__
-#define LM_BLANK__
+#ifndef LM_BLANK_H
+#define LM_BLANK_H
#include <limits>
@@ -40,4 +40,4 @@ inline bool HasExtension(const float &backoff) {
} // namespace ngram
} // namespace lm
-#endif // LM_BLANK__
+#endif // LM_BLANK_H
diff --git a/klm/lm/builder/Makefile.am b/klm/lm/builder/Makefile.am
index 38259c51..bb15ff04 100644
--- a/klm/lm/builder/Makefile.am
+++ b/klm/lm/builder/Makefile.am
@@ -1,4 +1,8 @@
-bin_PROGRAMS = lmplz
+bin_PROGRAMS = lmplz dump_counts
+
+dump_counts_SOURCES = \
+ print.cc \
+ dump_counts_main.cc
lmplz_SOURCES = \
lmplz_main.cc \
@@ -7,6 +11,7 @@ lmplz_SOURCES = \
corpus_count.cc \
corpus_count.hh \
discount.hh \
+ hash_gamma.hh \
header_info.hh \
initial_probabilities.cc \
initial_probabilities.hh \
@@ -22,6 +27,7 @@ lmplz_SOURCES = \
print.hh \
sort.hh
+dump_counts_LDADD = ../libklm.a ../../util/double-conversion/libklm_util_double.a ../../util/stream/libklm_util_stream.a ../../util/libklm_util.a $(BOOST_THREAD_LIBS)
lmplz_LDADD = ../libklm.a ../../util/double-conversion/libklm_util_double.a ../../util/stream/libklm_util_stream.a ../../util/libklm_util.a $(BOOST_THREAD_LIBS)
AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm
diff --git a/klm/lm/builder/adjust_counts.cc b/klm/lm/builder/adjust_counts.cc
index a6f48011..803c557d 100644
--- a/klm/lm/builder/adjust_counts.cc
+++ b/klm/lm/builder/adjust_counts.cc
@@ -1,8 +1,9 @@
#include "lm/builder/adjust_counts.hh"
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "util/stream/timer.hh"
#include <algorithm>
+#include <iostream>
namespace lm { namespace builder {
@@ -10,56 +11,78 @@ BadDiscountException::BadDiscountException() throw() {}
BadDiscountException::~BadDiscountException() throw() {}
namespace {
-// Return last word in full that is different.
+// Return last word in full that is different.
const WordIndex* FindDifference(const NGram &full, const NGram &lower_last) {
const WordIndex *cur_word = full.end() - 1;
const WordIndex *pre_word = lower_last.end() - 1;
- // Find last difference.
+ // Find last difference.
for (; pre_word >= lower_last.begin() && *pre_word == *cur_word; --cur_word, --pre_word) {}
return cur_word;
}
class StatCollector {
public:
- StatCollector(std::size_t order, std::vector<uint64_t> &counts, std::vector<Discount> &discounts)
- : orders_(order), full_(orders_.back()), counts_(counts), discounts_(discounts) {
+ StatCollector(std::size_t order, std::vector<uint64_t> &counts, std::vector<uint64_t> &counts_pruned, std::vector<Discount> &discounts)
+ : orders_(order), full_(orders_.back()), counts_(counts), counts_pruned_(counts_pruned), discounts_(discounts) {
memset(&orders_[0], 0, sizeof(OrderStat) * order);
}
~StatCollector() {}
- void CalculateDiscounts() {
+ void CalculateDiscounts(const DiscountConfig &config) {
counts_.resize(orders_.size());
- discounts_.resize(orders_.size());
+ counts_pruned_.resize(orders_.size());
for (std::size_t i = 0; i < orders_.size(); ++i) {
const OrderStat &s = orders_[i];
counts_[i] = s.count;
+ counts_pruned_[i] = s.count_pruned;
+ }
- for (unsigned j = 1; j < 4; ++j) {
- // TODO: Specialize error message for j == 3, meaning 3+
- UTIL_THROW_IF(s.n[j] == 0, BadDiscountException, "Could not calculate Kneser-Ney discounts for "
- << (i+1) << "-grams with adjusted count " << (j+1) << " because we didn't observe any "
- << (i+1) << "-grams with adjusted count " << j << "; Is this small or artificial data?");
- }
-
- // See equation (26) in Chen and Goodman.
- discounts_[i].amount[0] = 0.0;
- float y = static_cast<float>(s.n[1]) / static_cast<float>(s.n[1] + 2.0 * s.n[2]);
- for (unsigned j = 1; j < 4; ++j) {
- discounts_[i].amount[j] = static_cast<float>(j) - static_cast<float>(j + 1) * y * static_cast<float>(s.n[j+1]) / static_cast<float>(s.n[j]);
- UTIL_THROW_IF(discounts_[i].amount[j] < 0.0 || discounts_[i].amount[j] > j, BadDiscountException, "ERROR: " << (i+1) << "-gram discount out of range for adjusted count " << j << ": " << discounts_[i].amount[j]);
+ discounts_ = config.overwrite;
+ discounts_.resize(orders_.size());
+ for (std::size_t i = config.overwrite.size(); i < orders_.size(); ++i) {
+ const OrderStat &s = orders_[i];
+ try {
+ for (unsigned j = 1; j < 4; ++j) {
+ // TODO: Specialize error message for j == 3, meaning 3+
+ UTIL_THROW_IF(s.n[j] == 0, BadDiscountException, "Could not calculate Kneser-Ney discounts for "
+ << (i+1) << "-grams with adjusted count " << (j+1) << " because we didn't observe any "
+ << (i+1) << "-grams with adjusted count " << j << "; Is this small or artificial data?");
+ }
+
+ // See equation (26) in Chen and Goodman.
+ discounts_[i].amount[0] = 0.0;
+ float y = static_cast<float>(s.n[1]) / static_cast<float>(s.n[1] + 2.0 * s.n[2]);
+ for (unsigned j = 1; j < 4; ++j) {
+ discounts_[i].amount[j] = static_cast<float>(j) - static_cast<float>(j + 1) * y * static_cast<float>(s.n[j+1]) / static_cast<float>(s.n[j]);
+ UTIL_THROW_IF(discounts_[i].amount[j] < 0.0 || discounts_[i].amount[j] > j, BadDiscountException, "ERROR: " << (i+1) << "-gram discount out of range for adjusted count " << j << ": " << discounts_[i].amount[j]);
+ }
+ } catch (const BadDiscountException &e) {
+ switch (config.bad_action) {
+ case THROW_UP:
+ throw;
+ case COMPLAIN:
+ std::cerr << e.what() << " Substituting fallback discounts D1=" << config.fallback.amount[1] << " D2=" << config.fallback.amount[2] << " D3+=" << config.fallback.amount[3] << std::endl;
+ case SILENT:
+ break;
+ }
+ discounts_[i] = config.fallback;
}
}
}
- void Add(std::size_t order_minus_1, uint64_t count) {
+ void Add(std::size_t order_minus_1, uint64_t count, bool pruned = false) {
OrderStat &stat = orders_[order_minus_1];
++stat.count;
+ if (!pruned)
+ ++stat.count_pruned;
if (count < 5) ++stat.n[count];
}
- void AddFull(uint64_t count) {
+ void AddFull(uint64_t count, bool pruned = false) {
++full_.count;
+ if (!pruned)
+ ++full_.count_pruned;
if (count < 5) ++full_.n[count];
}
@@ -68,24 +91,27 @@ class StatCollector {
// n_1 in equation 26 of Chen and Goodman etc
uint64_t n[5];
uint64_t count;
+ uint64_t count_pruned;
};
std::vector<OrderStat> orders_;
OrderStat &full_;
std::vector<uint64_t> &counts_;
+ std::vector<uint64_t> &counts_pruned_;
std::vector<Discount> &discounts_;
};
-// Reads all entries in order like NGramStream does.
+// Reads all entries in order like NGramStream does.
// But deletes any entries that have <s> in the 1st (not 0th) position on the
// way out by putting other entries in their place. This disrupts the sort
-// order but we don't care because the data is going to be sorted again.
+// order but we don't care because the data is going to be sorted again.
class CollapseStream {
public:
- CollapseStream(const util::stream::ChainPosition &position) :
+ CollapseStream(const util::stream::ChainPosition &position, uint64_t prune_threshold) :
current_(NULL, NGram::OrderFromSize(position.GetChain().EntrySize())),
- block_(position) {
+ prune_threshold_(prune_threshold),
+ block_(position) {
StartBlock();
}
@@ -96,10 +122,18 @@ class CollapseStream {
CollapseStream &operator++() {
assert(block_);
+
if (current_.begin()[1] == kBOS && current_.Base() < copy_from_) {
memcpy(current_.Base(), copy_from_, current_.TotalSize());
UpdateCopyFrom();
+
+ // Mark highest order n-grams for later pruning
+ if(current_.Count() <= prune_threshold_) {
+ current_.Mark();
+ }
+
}
+
current_.NextInMemory();
uint8_t *block_base = static_cast<uint8_t*>(block_->Get());
if (current_.Base() == block_base + block_->ValidSize()) {
@@ -107,6 +141,12 @@ class CollapseStream {
++block_;
StartBlock();
}
+
+ // Mark highest order n-grams for later pruning
+ if(current_.Count() <= prune_threshold_) {
+ current_.Mark();
+ }
+
return *this;
}
@@ -119,9 +159,15 @@ class CollapseStream {
current_.ReBase(block_->Get());
copy_from_ = static_cast<uint8_t*>(block_->Get()) + block_->ValidSize();
UpdateCopyFrom();
+
+ // Mark highest order n-grams for later pruning
+ if(current_.Count() <= prune_threshold_) {
+ current_.Mark();
+ }
+
}
- // Find last without bos.
+ // Find last without bos.
void UpdateCopyFrom() {
for (copy_from_ -= current_.TotalSize(); copy_from_ >= current_.Base(); copy_from_ -= current_.TotalSize()) {
if (NGram(copy_from_, current_.Order()).begin()[1] != kBOS) break;
@@ -132,83 +178,107 @@ class CollapseStream {
// Goes backwards in the block
uint8_t *copy_from_;
-
+ uint64_t prune_threshold_;
util::stream::Link block_;
};
} // namespace
-void AdjustCounts::Run(const ChainPositions &positions) {
+void AdjustCounts::Run(const util::stream::ChainPositions &positions) {
UTIL_TIMER("(%w s) Adjusted counts\n");
const std::size_t order = positions.size();
- StatCollector stats(order, counts_, discounts_);
+ StatCollector stats(order, counts_, counts_pruned_, discounts_);
if (order == 1) {
+
// Only unigrams. Just collect stats.
for (NGramStream full(positions[0]); full; ++full)
stats.AddFull(full->Count());
- stats.CalculateDiscounts();
+
+ stats.CalculateDiscounts(discount_config_);
return;
}
NGramStreams streams;
streams.Init(positions, positions.size() - 1);
- CollapseStream full(positions[positions.size() - 1]);
+
+ CollapseStream full(positions[positions.size() - 1], prune_thresholds_.back());
- // Initialization: <unk> has count 0 and so does <s>.
+ // Initialization: <unk> has count 0 and so does <s>.
NGramStream *lower_valid = streams.begin();
streams[0]->Count() = 0;
*streams[0]->begin() = kUNK;
stats.Add(0, 0);
(++streams[0])->Count() = 0;
*streams[0]->begin() = kBOS;
- // not in stats because it will get put in later.
+ // not in stats because it will get put in later.
+ std::vector<uint64_t> lower_counts(positions.size(), 0);
+
// iterate over full (the stream of the highest order ngrams)
- for (; full; ++full) {
+ for (; full; ++full) {
const WordIndex *different = FindDifference(*full, **lower_valid);
std::size_t same = full->end() - 1 - different;
- // Increment the adjusted count.
+ // Increment the adjusted count.
if (same) ++streams[same - 1]->Count();
- // Output all the valid ones that changed.
+ // Output all the valid ones that changed.
for (; lower_valid >= &streams[same]; --lower_valid) {
- stats.Add(lower_valid - streams.begin(), (*lower_valid)->Count());
+
+ // mjd: review this!
+ uint64_t order = (*lower_valid)->Order();
+ uint64_t realCount = lower_counts[order - 1];
+ if(order > 1 && prune_thresholds_[order - 1] && realCount <= prune_thresholds_[order - 1])
+ (*lower_valid)->Mark();
+
+ stats.Add(lower_valid - streams.begin(), (*lower_valid)->UnmarkedCount(), (*lower_valid)->IsMarked());
++*lower_valid;
}
+
+ // Count the true occurrences of lower-order n-grams
+ for (std::size_t i = 0; i < lower_counts.size(); ++i) {
+ if (i >= same) {
+ lower_counts[i] = 0;
+ }
+ lower_counts[i] += full->UnmarkedCount();
+ }
// This is here because bos is also const WordIndex *, so copy gets
- // consistent argument types.
+ // consistent argument types.
const WordIndex *full_end = full->end();
- // Initialize and mark as valid up to bos.
+ // Initialize and mark as valid up to bos.
const WordIndex *bos;
for (bos = different; (bos > full->begin()) && (*bos != kBOS); --bos) {
++lower_valid;
std::copy(bos, full_end, (*lower_valid)->begin());
(*lower_valid)->Count() = 1;
}
- // Now bos indicates where <s> is or is the 0th word of full.
+ // Now bos indicates where <s> is or is the 0th word of full.
if (bos != full->begin()) {
- // There is an <s> beyond the 0th word.
+ // There is an <s> beyond the 0th word.
NGramStream &to = *++lower_valid;
std::copy(bos, full_end, to->begin());
- to->Count() = full->Count();
+
+ // mjd: what is this doing?
+ to->Count() = full->UnmarkedCount();
} else {
- stats.AddFull(full->Count());
+ stats.AddFull(full->UnmarkedCount(), full->IsMarked());
}
assert(lower_valid >= &streams[0]);
}
// Output everything valid.
for (NGramStream *s = streams.begin(); s <= lower_valid; ++s) {
- stats.Add(s - streams.begin(), (*s)->Count());
+ if((*s)->Count() <= prune_thresholds_[(*s)->Order() - 1])
+ (*s)->Mark();
+ stats.Add(s - streams.begin(), (*s)->UnmarkedCount(), (*s)->IsMarked());
++*s;
}
- // Poison everyone! Except the N-grams which were already poisoned by the input.
+ // Poison everyone! Except the N-grams which were already poisoned by the input.
for (NGramStream *s = streams.begin(); s != streams.end(); ++s)
s->Poison();
- stats.CalculateDiscounts();
+ stats.CalculateDiscounts(discount_config_);
// NOTE: See special early-return case for unigrams near the top of this function
}
diff --git a/klm/lm/builder/adjust_counts.hh b/klm/lm/builder/adjust_counts.hh
index f38ff79d..a5435c28 100644
--- a/klm/lm/builder/adjust_counts.hh
+++ b/klm/lm/builder/adjust_counts.hh
@@ -1,24 +1,35 @@
-#ifndef LM_BUILDER_ADJUST_COUNTS__
-#define LM_BUILDER_ADJUST_COUNTS__
+#ifndef LM_BUILDER_ADJUST_COUNTS_H
+#define LM_BUILDER_ADJUST_COUNTS_H
#include "lm/builder/discount.hh"
+#include "lm/lm_exception.hh"
#include "util/exception.hh"
#include <vector>
#include <stdint.h>
+namespace util { namespace stream { class ChainPositions; } }
+
namespace lm {
namespace builder {
-class ChainPositions;
-
class BadDiscountException : public util::Exception {
public:
BadDiscountException() throw();
~BadDiscountException() throw();
};
+struct DiscountConfig {
+ // Overrides discounts for orders [1,discount_override.size()].
+ std::vector<Discount> overwrite;
+ // If discounting fails for an order, copy them from here.
+ Discount fallback;
+ // What to do when discounts are out of range or would trigger divison by
+ // zero. It it does something other than THROW_UP, use fallback_discount.
+ WarningAction bad_action;
+};
+
/* Compute adjusted counts.
* Input: unique suffix sorted N-grams (and just the N-grams) with raw counts.
* Output: [1,N]-grams with adjusted counts.
@@ -27,18 +38,32 @@ class BadDiscountException : public util::Exception {
*/
class AdjustCounts {
public:
- AdjustCounts(std::vector<uint64_t> &counts, std::vector<Discount> &discounts)
- : counts_(counts), discounts_(discounts) {}
+ // counts: output
+ // counts_pruned: output
+ // discounts: mostly output. If the input already has entries, they will be kept.
+ // prune_thresholds: input. n-grams with normal (not adjusted) count below this will be pruned.
+ AdjustCounts(
+ const std::vector<uint64_t> &prune_thresholds,
+ std::vector<uint64_t> &counts,
+ std::vector<uint64_t> &counts_pruned,
+ const DiscountConfig &discount_config,
+ std::vector<Discount> &discounts)
+ : prune_thresholds_(prune_thresholds), counts_(counts), counts_pruned_(counts_pruned), discount_config_(discount_config), discounts_(discounts)
+ {}
- void Run(const ChainPositions &positions);
+ void Run(const util::stream::ChainPositions &positions);
private:
+ const std::vector<uint64_t> &prune_thresholds_;
std::vector<uint64_t> &counts_;
+ std::vector<uint64_t> &counts_pruned_;
+
+ DiscountConfig discount_config_;
std::vector<Discount> &discounts_;
};
} // namespace builder
} // namespace lm
-#endif // LM_BUILDER_ADJUST_COUNTS__
+#endif // LM_BUILDER_ADJUST_COUNTS_H
diff --git a/klm/lm/builder/adjust_counts_test.cc b/klm/lm/builder/adjust_counts_test.cc
index 68b5f33e..073c5dfe 100644
--- a/klm/lm/builder/adjust_counts_test.cc
+++ b/klm/lm/builder/adjust_counts_test.cc
@@ -1,6 +1,6 @@
#include "lm/builder/adjust_counts.hh"
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "util/scoped.hh"
#include <boost/thread/thread.hpp>
@@ -61,19 +61,24 @@ BOOST_AUTO_TEST_CASE(Simple) {
util::stream::ChainConfig config;
config.total_memory = 100;
config.block_count = 1;
- Chains chains(4);
+ util::stream::Chains chains(4);
for (unsigned i = 0; i < 4; ++i) {
config.entry_size = NGram::TotalSize(i + 1);
chains.push_back(config);
}
chains[3] >> WriteInput();
- ChainPositions for_adjust(chains);
+ util::stream::ChainPositions for_adjust(chains);
for (unsigned i = 0; i < 4; ++i) {
chains[i] >> boost::ref(outputs[i]);
}
chains >> util::stream::kRecycle;
- BOOST_CHECK_THROW(AdjustCounts(counts, discount).Run(for_adjust), BadDiscountException);
+ std::vector<uint64_t> counts_pruned(4);
+ std::vector<uint64_t> prune_thresholds(4);
+ DiscountConfig discount_config;
+ discount_config.fallback = Discount();
+ discount_config.bad_action = THROW_UP;
+ BOOST_CHECK_THROW(AdjustCounts(prune_thresholds, counts, counts_pruned, discount_config, discount).Run(for_adjust), BadDiscountException);
}
BOOST_REQUIRE_EQUAL(4UL, counts.size());
BOOST_CHECK_EQUAL(4UL, counts[0]);
diff --git a/klm/lm/builder/corpus_count.cc b/klm/lm/builder/corpus_count.cc
index ccc06efc..590e79fa 100644
--- a/klm/lm/builder/corpus_count.cc
+++ b/klm/lm/builder/corpus_count.cc
@@ -2,6 +2,7 @@
#include "lm/builder/ngram.hh"
#include "lm/lm_exception.hh"
+#include "lm/vocab.hh"
#include "lm/word_index.hh"
#include "util/fake_ofstream.hh"
#include "util/file.hh"
@@ -37,60 +38,6 @@ struct VocabEntry {
};
#pragma pack(pop)
-const float kProbingMultiplier = 1.5;
-
-class VocabHandout {
- public:
- static std::size_t MemUsage(WordIndex initial_guess) {
- if (initial_guess < 2) initial_guess = 2;
- return util::CheckOverflow(Table::Size(initial_guess, kProbingMultiplier));
- }
-
- explicit VocabHandout(int fd, WordIndex initial_guess) :
- table_backing_(util::CallocOrThrow(MemUsage(initial_guess))),
- table_(table_backing_.get(), MemUsage(initial_guess)),
- double_cutoff_(std::max<std::size_t>(initial_guess * 1.1, 1)),
- word_list_(fd) {
- Lookup("<unk>"); // Force 0
- Lookup("<s>"); // Force 1
- Lookup("</s>"); // Force 2
- }
-
- WordIndex Lookup(const StringPiece &word) {
- VocabEntry entry;
- entry.key = util::MurmurHashNative(word.data(), word.size());
- entry.value = table_.SizeNoSerialization();
-
- Table::MutableIterator it;
- if (table_.FindOrInsert(entry, it))
- return it->value;
- word_list_ << word << '\0';
- UTIL_THROW_IF(Size() >= std::numeric_limits<lm::WordIndex>::max(), VocabLoadException, "Too many vocabulary words. Change WordIndex to uint64_t in lm/word_index.hh.");
- if (Size() >= double_cutoff_) {
- table_backing_.call_realloc(table_.DoubleTo());
- table_.Double(table_backing_.get());
- double_cutoff_ *= 2;
- }
- return entry.value;
- }
-
- WordIndex Size() const {
- return table_.SizeNoSerialization();
- }
-
- private:
- // TODO: factor out a resizable probing hash table.
- // TODO: use mremap on linux to get all zeros on resizes.
- util::scoped_malloc table_backing_;
-
- typedef util::ProbingHashTable<VocabEntry, util::IdentityHash> Table;
- Table table_;
-
- std::size_t double_cutoff_;
-
- util::FakeOFStream word_list_;
-};
-
class DedupeHash : public std::unary_function<const WordIndex *, bool> {
public:
explicit DedupeHash(std::size_t order) : size_(order * sizeof(WordIndex)) {}
@@ -127,6 +74,10 @@ struct DedupeEntry {
}
};
+
+// TODO: don't have this here, should be with probing hash table defaults?
+const float kProbingMultiplier = 1.5;
+
typedef util::ProbingHashTable<DedupeEntry, DedupeHash, DedupeEquals> Dedupe;
class Writer {
@@ -220,37 +171,50 @@ float CorpusCount::DedupeMultiplier(std::size_t order) {
}
std::size_t CorpusCount::VocabUsage(std::size_t vocab_estimate) {
- return VocabHandout::MemUsage(vocab_estimate);
+ return ngram::GrowableVocab<ngram::WriteUniqueWords>::MemUsage(vocab_estimate);
}
-CorpusCount::CorpusCount(util::FilePiece &from, int vocab_write, uint64_t &token_count, WordIndex &type_count, std::size_t entries_per_block)
+CorpusCount::CorpusCount(util::FilePiece &from, int vocab_write, uint64_t &token_count, WordIndex &type_count, std::size_t entries_per_block, WarningAction disallowed_symbol)
: from_(from), vocab_write_(vocab_write), token_count_(token_count), type_count_(type_count),
dedupe_mem_size_(Dedupe::Size(entries_per_block, kProbingMultiplier)),
- dedupe_mem_(util::MallocOrThrow(dedupe_mem_size_)) {
+ dedupe_mem_(util::MallocOrThrow(dedupe_mem_size_)),
+ disallowed_symbol_action_(disallowed_symbol) {
}
-void CorpusCount::Run(const util::stream::ChainPosition &position) {
- UTIL_TIMER("(%w s) Counted n-grams\n");
+namespace {
+ void ComplainDisallowed(StringPiece word, WarningAction &action) {
+ switch (action) {
+ case SILENT:
+ return;
+ case COMPLAIN:
+ std::cerr << "Warning: " << word << " appears in the input. All instances of <s>, </s>, and <unk> will be interpreted as whitespace." << std::endl;
+ action = SILENT;
+ return;
+ case THROW_UP:
+ UTIL_THROW(FormatLoadException, "Special word " << word << " is not allowed in the corpus. I plan to support models containing <unk> in the future. Pass --skip_symbols to convert these symbols to whitespace.");
+ }
+ }
+} // namespace
- VocabHandout vocab(vocab_write_, type_count_);
+void CorpusCount::Run(const util::stream::ChainPosition &position) {
+ ngram::GrowableVocab<ngram::WriteUniqueWords> vocab(type_count_, vocab_write_);
token_count_ = 0;
type_count_ = 0;
- const WordIndex end_sentence = vocab.Lookup("</s>");
+ const WordIndex end_sentence = vocab.FindOrInsert("</s>");
Writer writer(NGram::OrderFromSize(position.GetChain().EntrySize()), position, dedupe_mem_.get(), dedupe_mem_size_);
uint64_t count = 0;
bool delimiters[256];
- memset(delimiters, 0, sizeof(delimiters));
- const char kDelimiterSet[] = "\0\t\n\r ";
- for (const char *i = kDelimiterSet; i < kDelimiterSet + sizeof(kDelimiterSet); ++i) {
- delimiters[static_cast<unsigned char>(*i)] = true;
- }
+ util::BoolCharacter::Build("\0\t\n\r ", delimiters);
try {
while(true) {
StringPiece line(from_.ReadLine());
writer.StartSentence();
for (util::TokenIter<util::BoolCharacter, true> w(line, delimiters); w; ++w) {
- WordIndex word = vocab.Lookup(*w);
- UTIL_THROW_IF(word <= 2, FormatLoadException, "Special word " << *w << " is not allowed in the corpus. I plan to support models containing <unk> in the future.");
+ WordIndex word = vocab.FindOrInsert(*w);
+ if (word <= 2) {
+ ComplainDisallowed(*w, disallowed_symbol_action_);
+ continue;
+ }
writer.Append(word);
++count;
}
diff --git a/klm/lm/builder/corpus_count.hh b/klm/lm/builder/corpus_count.hh
index aa0ed8ed..da4ff9fc 100644
--- a/klm/lm/builder/corpus_count.hh
+++ b/klm/lm/builder/corpus_count.hh
@@ -1,6 +1,7 @@
-#ifndef LM_BUILDER_CORPUS_COUNT__
-#define LM_BUILDER_CORPUS_COUNT__
+#ifndef LM_BUILDER_CORPUS_COUNT_H
+#define LM_BUILDER_CORPUS_COUNT_H
+#include "lm/lm_exception.hh"
#include "lm/word_index.hh"
#include "util/scoped.hh"
@@ -28,7 +29,7 @@ class CorpusCount {
// token_count: out.
// type_count aka vocabulary size. Initialize to an estimate. It is set to the exact value.
- CorpusCount(util::FilePiece &from, int vocab_write, uint64_t &token_count, WordIndex &type_count, std::size_t entries_per_block);
+ CorpusCount(util::FilePiece &from, int vocab_write, uint64_t &token_count, WordIndex &type_count, std::size_t entries_per_block, WarningAction disallowed_symbol);
void Run(const util::stream::ChainPosition &position);
@@ -40,8 +41,10 @@ class CorpusCount {
std::size_t dedupe_mem_size_;
util::scoped_malloc dedupe_mem_;
+
+ WarningAction disallowed_symbol_action_;
};
} // namespace builder
} // namespace lm
-#endif // LM_BUILDER_CORPUS_COUNT__
+#endif // LM_BUILDER_CORPUS_COUNT_H
diff --git a/klm/lm/builder/corpus_count_test.cc b/klm/lm/builder/corpus_count_test.cc
index 6d325ef5..26cb6346 100644
--- a/klm/lm/builder/corpus_count_test.cc
+++ b/klm/lm/builder/corpus_count_test.cc
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(Short) {
NGramStream stream;
uint64_t token_count;
WordIndex type_count = 10;
- CorpusCount counter(input_piece, vocab.get(), token_count, type_count, chain.BlockSize() / chain.EntrySize());
+ CorpusCount counter(input_piece, vocab.get(), token_count, type_count, chain.BlockSize() / chain.EntrySize(), SILENT);
chain >> boost::ref(counter) >> stream >> util::stream::kRecycle;
const char *v[] = {"<unk>", "<s>", "</s>", "looking", "on", "a", "little", "more", "loin", "foo", "bar"};
diff --git a/klm/lm/builder/discount.hh b/klm/lm/builder/discount.hh
index 4d0aa4fd..e2f40846 100644
--- a/klm/lm/builder/discount.hh
+++ b/klm/lm/builder/discount.hh
@@ -1,5 +1,5 @@
-#ifndef BUILDER_DISCOUNT__
-#define BUILDER_DISCOUNT__
+#ifndef LM_BUILDER_DISCOUNT_H
+#define LM_BUILDER_DISCOUNT_H
#include <algorithm>
@@ -23,4 +23,4 @@ struct Discount {
} // namespace builder
} // namespace lm
-#endif // BUILDER_DISCOUNT__
+#endif // LM_BUILDER_DISCOUNT_H
diff --git a/klm/lm/builder/dump_counts_main.cc b/klm/lm/builder/dump_counts_main.cc
new file mode 100644
index 00000000..fa001679
--- /dev/null
+++ b/klm/lm/builder/dump_counts_main.cc
@@ -0,0 +1,36 @@
+#include "lm/builder/print.hh"
+#include "lm/word_index.hh"
+#include "util/file.hh"
+#include "util/read_compressed.hh"
+
+#include <boost/lexical_cast.hpp>
+
+#include <iostream>
+#include <vector>
+
+int main(int argc, char *argv[]) {
+ if (argc != 4) {
+ std::cerr << "Usage: " << argv[0] << " counts vocabulary order\n"
+ "The counts file contains records with 4-byte vocabulary ids followed by 8-byte\n"
+ "counts. Each record has order many vocabulary ids.\n"
+ "The vocabulary file contains the words delimited by NULL in order of id.\n"
+ "The vocabulary file may not be compressed because it is mmapped but the counts\n"
+ "file can be compressed.\n";
+ return 1;
+ }
+ util::ReadCompressed counts(util::OpenReadOrThrow(argv[1]));
+ util::scoped_fd vocab_file(util::OpenReadOrThrow(argv[2]));
+ lm::builder::VocabReconstitute vocab(vocab_file.get());
+ unsigned int order = boost::lexical_cast<unsigned int>(argv[3]);
+ std::vector<char> record(sizeof(uint32_t) * order + sizeof(uint64_t));
+ while (std::size_t got = counts.ReadOrEOF(&*record.begin(), record.size())) {
+ UTIL_THROW_IF(got != record.size(), util::Exception, "Read " << got << " bytes at the end of file, which is not a complete record of length " << record.size());
+ const lm::WordIndex *words = reinterpret_cast<const lm::WordIndex*>(&*record.begin());
+ for (const lm::WordIndex *i = words; i != words + order; ++i) {
+ UTIL_THROW_IF(*i >= vocab.Size(), util::Exception, "Vocab ID " << *i << " is larger than the vocab file's maximum of " << vocab.Size() << ". Are you sure you have the right order and vocab file for these counts?");
+ std::cout << vocab.Lookup(*i) << ' ';
+ }
+ // TODO don't use std::cout because it is slow. Add fast uint64_t printing support to FakeOFStream.
+ std::cout << *reinterpret_cast<const uint64_t*>(words + order) << '\n';
+ }
+}
diff --git a/klm/lm/builder/hash_gamma.hh b/klm/lm/builder/hash_gamma.hh
new file mode 100644
index 00000000..4bef47e8
--- /dev/null
+++ b/klm/lm/builder/hash_gamma.hh
@@ -0,0 +1,19 @@
+#ifndef LM_BUILDER_HASH_GAMMA__
+#define LM_BUILDER_HASH_GAMMA__
+
+#include <stdint.h>
+
+namespace lm { namespace builder {
+
+#pragma pack(push)
+#pragma pack(4)
+
+struct HashGamma {
+ uint64_t hash_value;
+ float gamma;
+};
+
+#pragma pack(pop)
+
+}} // namespaces
+#endif // LM_BUILDER_HASH_GAMMA__
diff --git a/klm/lm/builder/header_info.hh b/klm/lm/builder/header_info.hh
index ccca1456..16f3f609 100644
--- a/klm/lm/builder/header_info.hh
+++ b/klm/lm/builder/header_info.hh
@@ -1,5 +1,5 @@
-#ifndef LM_BUILDER_HEADER_INFO__
-#define LM_BUILDER_HEADER_INFO__
+#ifndef LM_BUILDER_HEADER_INFO_H
+#define LM_BUILDER_HEADER_INFO_H
#include <string>
#include <stdint.h>
diff --git a/klm/lm/builder/initial_probabilities.cc b/klm/lm/builder/initial_probabilities.cc
index 58b42a20..5d19a897 100644
--- a/klm/lm/builder/initial_probabilities.cc
+++ b/klm/lm/builder/initial_probabilities.cc
@@ -3,6 +3,8 @@
#include "lm/builder/discount.hh"
#include "lm/builder/ngram_stream.hh"
#include "lm/builder/sort.hh"
+#include "lm/builder/hash_gamma.hh"
+#include "util/murmur_hash.hh"
#include "util/file.hh"
#include "util/stream/chain.hh"
#include "util/stream/io.hh"
@@ -14,55 +16,182 @@ namespace lm { namespace builder {
namespace {
struct BufferEntry {
- // Gamma from page 20 of Chen and Goodman.
+ // Gamma from page 20 of Chen and Goodman.
float gamma;
- // \sum_w a(c w) for all w.
+ // \sum_w a(c w) for all w.
float denominator;
};
-// Extract an array of gamma from an array of BufferEntry.
+struct HashBufferEntry : public BufferEntry {
+ // Hash value of ngram. Used to join contexts with backoffs.
+ uint64_t hash_value;
+};
+
+// Reads all entries in order like NGramStream does.
+// But deletes any entries that have CutoffCount below or equal to pruning
+// threshold.
+class PruneNGramStream {
+ public:
+ PruneNGramStream(const util::stream::ChainPosition &position) :
+ current_(NULL, NGram::OrderFromSize(position.GetChain().EntrySize())),
+ dest_(NULL, NGram::OrderFromSize(position.GetChain().EntrySize())),
+ currentCount_(0),
+ block_(position)
+ {
+ StartBlock();
+ }
+
+ NGram &operator*() { return current_; }
+ NGram *operator->() { return &current_; }
+
+ operator bool() const {
+ return block_;
+ }
+
+ PruneNGramStream &operator++() {
+ assert(block_);
+
+ if (current_.Order() > 1) {
+ if(currentCount_ > 0) {
+ if(dest_.Base() < current_.Base()) {
+ memcpy(dest_.Base(), current_.Base(), current_.TotalSize());
+ }
+ dest_.NextInMemory();
+ }
+ } else {
+ dest_.NextInMemory();
+ }
+
+ current_.NextInMemory();
+
+ uint8_t *block_base = static_cast<uint8_t*>(block_->Get());
+ if (current_.Base() == block_base + block_->ValidSize()) {
+ block_->SetValidSize(dest_.Base() - block_base);
+ ++block_;
+ StartBlock();
+ if (block_) {
+ currentCount_ = current_.CutoffCount();
+ }
+ } else {
+ currentCount_ = current_.CutoffCount();
+ }
+
+ return *this;
+ }
+
+ private:
+ void StartBlock() {
+ for (; ; ++block_) {
+ if (!block_) return;
+ if (block_->ValidSize()) break;
+ }
+ current_.ReBase(block_->Get());
+ currentCount_ = current_.CutoffCount();
+
+ dest_.ReBase(block_->Get());
+ }
+
+ NGram current_; // input iterator
+ NGram dest_; // output iterator
+
+ uint64_t currentCount_;
+
+ util::stream::Link block_;
+};
+
+// Extract an array of HashedGamma from an array of BufferEntry.
class OnlyGamma {
public:
+ OnlyGamma(bool pruning) : pruning_(pruning) {}
+
void Run(const util::stream::ChainPosition &position) {
for (util::stream::Link block_it(position); block_it; ++block_it) {
- float *out = static_cast<float*>(block_it->Get());
- const float *in = out;
- const float *end = static_cast<const float*>(block_it->ValidEnd());
- for (out += 1, in += 2; in < end; out += 1, in += 2) {
- *out = *in;
+ if(pruning_) {
+ const HashBufferEntry *in = static_cast<const HashBufferEntry*>(block_it->Get());
+ const HashBufferEntry *end = static_cast<const HashBufferEntry*>(block_it->ValidEnd());
+
+ // Just make it point to the beginning of the stream so it can be overwritten
+ // With HashGamma values. Do not attempt to interpret the values until set below.
+ HashGamma *out = static_cast<HashGamma*>(block_it->Get());
+ for (; in < end; out += 1, in += 1) {
+ // buffering, otherwise might overwrite values too early
+ float gamma_buf = in->gamma;
+ uint64_t hash_buf = in->hash_value;
+
+ out->gamma = gamma_buf;
+ out->hash_value = hash_buf;
+ }
+ block_it->SetValidSize((block_it->ValidSize() * sizeof(HashGamma)) / sizeof(HashBufferEntry));
+ }
+ else {
+ float *out = static_cast<float*>(block_it->Get());
+ const float *in = out;
+ const float *end = static_cast<const float*>(block_it->ValidEnd());
+ for (out += 1, in += 2; in < end; out += 1, in += 2) {
+ *out = *in;
+ }
+ block_it->SetValidSize(block_it->ValidSize() / 2);
}
- block_it->SetValidSize(block_it->ValidSize() / 2);
}
}
+
+ private:
+ bool pruning_;
};
class AddRight {
public:
- AddRight(const Discount &discount, const util::stream::ChainPosition &input)
- : discount_(discount), input_(input) {}
+ AddRight(const Discount &discount, const util::stream::ChainPosition &input, bool pruning)
+ : discount_(discount), input_(input), pruning_(pruning) {}
void Run(const util::stream::ChainPosition &output) {
NGramStream in(input_);
util::stream::Stream out(output);
std::vector<WordIndex> previous(in->Order() - 1);
+ // Silly windows requires this workaround to just get an invalid pointer when empty.
+ void *const previous_raw = previous.empty() ? NULL : static_cast<void*>(&previous[0]);
const std::size_t size = sizeof(WordIndex) * previous.size();
+
for(; in; ++out) {
- memcpy(&previous[0], in->begin(), size);
+ memcpy(previous_raw, in->begin(), size);
uint64_t denominator = 0;
+ uint64_t normalizer = 0;
+
uint64_t counts[4];
memset(counts, 0, sizeof(counts));
do {
- denominator += in->Count();
- ++counts[std::min(in->Count(), static_cast<uint64_t>(3))];
- } while (++in && !memcmp(&previous[0], in->begin(), size));
+ denominator += in->UnmarkedCount();
+
+ // Collect unused probability mass from pruning.
+ // Becomes 0 for unpruned ngrams.
+ normalizer += in->UnmarkedCount() - in->CutoffCount();
+
+ // Chen&Goodman do not mention counting based on cutoffs, but
+ // backoff becomes larger than 1 otherwise, so probably needs
+ // to count cutoffs. Counts normally without pruning.
+ if(in->CutoffCount() > 0)
+ ++counts[std::min(in->CutoffCount(), static_cast<uint64_t>(3))];
+
+ } while (++in && !memcmp(previous_raw, in->begin(), size));
+
BufferEntry &entry = *reinterpret_cast<BufferEntry*>(out.Get());
entry.denominator = static_cast<float>(denominator);
entry.gamma = 0.0;
for (unsigned i = 1; i <= 3; ++i) {
entry.gamma += discount_.Get(i) * static_cast<float>(counts[i]);
}
+
+ // Makes model sum to 1 with pruning (I hope).
+ entry.gamma += normalizer;
+
entry.gamma /= entry.denominator;
+
+ if(pruning_) {
+ // If pruning is enabled the stream actually contains HashBufferEntry, see InitialProbabilities(...),
+ // so add a hash value that identifies the current ngram.
+ static_cast<HashBufferEntry*>(&entry)->hash_value = util::MurmurHashNative(previous_raw, size);
+ }
}
out.Poison();
}
@@ -70,6 +199,7 @@ class AddRight {
private:
const Discount &discount_;
const util::stream::ChainPosition input_;
+ bool pruning_;
};
class MergeRight {
@@ -82,7 +212,7 @@ class MergeRight {
void Run(const util::stream::ChainPosition &primary) {
util::stream::Stream summed(from_adder_);
- NGramStream grams(primary);
+ PruneNGramStream grams(primary);
// Without interpolation, the interpolation weight goes to <unk>.
if (grams->Order() == 1 && !interpolate_unigrams_) {
@@ -97,15 +227,16 @@ class MergeRight {
++summed;
return;
}
-
+
std::vector<WordIndex> previous(grams->Order() - 1);
const std::size_t size = sizeof(WordIndex) * previous.size();
for (; grams; ++summed) {
memcpy(&previous[0], grams->begin(), size);
const BufferEntry &sums = *static_cast<const BufferEntry*>(summed.Get());
+
do {
Payload &pay = grams->Value();
- pay.uninterp.prob = discount_.Apply(pay.count) / sums.denominator;
+ pay.uninterp.prob = discount_.Apply(grams->UnmarkedCount()) / sums.denominator;
pay.uninterp.gamma = sums.gamma;
} while (++grams && !memcmp(&previous[0], grams->begin(), size));
}
@@ -119,17 +250,29 @@ class MergeRight {
} // namespace
-void InitialProbabilities(const InitialProbabilitiesConfig &config, const std::vector<Discount> &discounts, Chains &primary, Chains &second_in, Chains &gamma_out) {
- util::stream::ChainConfig gamma_config = config.adder_out;
- gamma_config.entry_size = sizeof(BufferEntry);
+void InitialProbabilities(
+ const InitialProbabilitiesConfig &config,
+ const std::vector<Discount> &discounts,
+ util::stream::Chains &primary,
+ util::stream::Chains &second_in,
+ util::stream::Chains &gamma_out,
+ const std::vector<uint64_t> &prune_thresholds) {
for (size_t i = 0; i < primary.size(); ++i) {
+ util::stream::ChainConfig gamma_config = config.adder_out;
+ if(prune_thresholds[i] > 0)
+ gamma_config.entry_size = sizeof(HashBufferEntry);
+ else
+ gamma_config.entry_size = sizeof(BufferEntry);
+
util::stream::ChainPosition second(second_in[i].Add());
second_in[i] >> util::stream::kRecycle;
gamma_out.push_back(gamma_config);
- gamma_out[i] >> AddRight(discounts[i], second);
+ gamma_out[i] >> AddRight(discounts[i], second, prune_thresholds[i] > 0);
+
primary[i] >> MergeRight(config.interpolate_unigrams, gamma_out[i].Add(), discounts[i]);
- // Don't bother with the OnlyGamma thread for something to discard.
- if (i) gamma_out[i] >> OnlyGamma();
+
+ // Don't bother with the OnlyGamma thread for something to discard.
+ if (i) gamma_out[i] >> OnlyGamma(prune_thresholds[i] > 0);
}
}
diff --git a/klm/lm/builder/initial_probabilities.hh b/klm/lm/builder/initial_probabilities.hh
index 626388eb..c1010e08 100644
--- a/klm/lm/builder/initial_probabilities.hh
+++ b/klm/lm/builder/initial_probabilities.hh
@@ -1,14 +1,15 @@
-#ifndef LM_BUILDER_INITIAL_PROBABILITIES__
-#define LM_BUILDER_INITIAL_PROBABILITIES__
+#ifndef LM_BUILDER_INITIAL_PROBABILITIES_H
+#define LM_BUILDER_INITIAL_PROBABILITIES_H
#include "lm/builder/discount.hh"
#include "util/stream/config.hh"
#include <vector>
+namespace util { namespace stream { class Chains; } }
+
namespace lm {
namespace builder {
-class Chains;
struct InitialProbabilitiesConfig {
// These should be small buffers to keep the adder from getting too far ahead
@@ -26,9 +27,15 @@ struct InitialProbabilitiesConfig {
* The values are bare floats and should be buffered for interpolation to
* use.
*/
-void InitialProbabilities(const InitialProbabilitiesConfig &config, const std::vector<Discount> &discounts, Chains &primary, Chains &second_in, Chains &gamma_out);
+void InitialProbabilities(
+ const InitialProbabilitiesConfig &config,
+ const std::vector<Discount> &discounts,
+ util::stream::Chains &primary,
+ util::stream::Chains &second_in,
+ util::stream::Chains &gamma_out,
+ const std::vector<uint64_t> &prune_thresholds);
} // namespace builder
} // namespace lm
-#endif // LM_BUILDER_INITIAL_PROBABILITIES__
+#endif // LM_BUILDER_INITIAL_PROBABILITIES_H
diff --git a/klm/lm/builder/interpolate.cc b/klm/lm/builder/interpolate.cc
index 50026806..a7947a42 100644
--- a/klm/lm/builder/interpolate.cc
+++ b/klm/lm/builder/interpolate.cc
@@ -1,18 +1,74 @@
#include "lm/builder/interpolate.hh"
+#include "lm/builder/hash_gamma.hh"
#include "lm/builder/joint_order.hh"
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "lm/builder/sort.hh"
#include "lm/lm_exception.hh"
+#include "util/fixed_array.hh"
+#include "util/murmur_hash.hh"
#include <assert.h>
+#include <math.h>
namespace lm { namespace builder {
namespace {
-class Callback {
+/* Calculate q, the collapsed probability and backoff, as defined in
+ * @inproceedings{Heafield-rest,
+ * author = {Kenneth Heafield and Philipp Koehn and Alon Lavie},
+ * title = {Language Model Rest Costs and Space-Efficient Storage},
+ * year = {2012},
+ * month = {July},
+ * booktitle = {Proceedings of the Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning},
+ * address = {Jeju Island, Korea},
+ * pages = {1169--1178},
+ * url = {http://kheafield.com/professional/edinburgh/rest\_paper.pdf},
+ * }
+ * This is particularly convenient to calculate during interpolation because
+ * the needed backoff terms are already accessed at the same time.
+ */
+class OutputQ {
public:
- Callback(float uniform_prob, const ChainPositions &backoffs) : backoffs_(backoffs.size()), probs_(backoffs.size() + 2) {
+ explicit OutputQ(std::size_t order) : q_delta_(order) {}
+
+ void Gram(unsigned order_minus_1, float full_backoff, ProbBackoff &out) {
+ float &q_del = q_delta_[order_minus_1];
+ if (order_minus_1) {
+ // Divide by context's backoff (which comes in as out.backoff)
+ q_del = q_delta_[order_minus_1 - 1] / out.backoff * full_backoff;
+ } else {
+ q_del = full_backoff;
+ }
+ out.prob = log10f(out.prob * q_del);
+ // TODO: stop wastefully outputting this!
+ out.backoff = 0.0;
+ }
+
+ private:
+ // Product of backoffs in the numerator divided by backoffs in the
+ // denominator. Does not include
+ std::vector<float> q_delta_;
+};
+
+/* Default: output probability and backoff */
+class OutputProbBackoff {
+ public:
+ explicit OutputProbBackoff(std::size_t /*order*/) {}
+
+ void Gram(unsigned /*order_minus_1*/, float full_backoff, ProbBackoff &out) const {
+ // Correcting for numerical precision issues. Take that IRST.
+ out.prob = std::min(0.0f, log10f(out.prob));
+ out.backoff = log10f(full_backoff);
+ }
+};
+
+template <class Output> class Callback {
+ public:
+ Callback(float uniform_prob, const util::stream::ChainPositions &backoffs, const std::vector<uint64_t> &prune_thresholds)
+ : backoffs_(backoffs.size()), probs_(backoffs.size() + 2),
+ prune_thresholds_(prune_thresholds),
+ output_(backoffs.size() + 1 /* order */) {
probs_[0] = uniform_prob;
for (std::size_t i = 0; i < backoffs.size(); ++i) {
backoffs_.push_back(backoffs[i]);
@@ -21,6 +77,10 @@ class Callback {
~Callback() {
for (std::size_t i = 0; i < backoffs_.size(); ++i) {
+ if(prune_thresholds_[i + 1] > 0)
+ while(backoffs_[i])
+ ++backoffs_[i];
+
if (backoffs_[i]) {
std::cerr << "Backoffs do not match for order " << (i + 1) << std::endl;
abort();
@@ -32,34 +92,66 @@ class Callback {
Payload &pay = gram.Value();
pay.complete.prob = pay.uninterp.prob + pay.uninterp.gamma * probs_[order_minus_1];
probs_[order_minus_1 + 1] = pay.complete.prob;
- pay.complete.prob = log10(pay.complete.prob);
- // TODO: this is a hack to skip n-grams that don't appear as context. Pruning will require some different handling.
+
+ float out_backoff;
if (order_minus_1 < backoffs_.size() && *(gram.end() - 1) != kUNK && *(gram.end() - 1) != kEOS) {
- pay.complete.backoff = log10(*static_cast<const float*>(backoffs_[order_minus_1].Get()));
- ++backoffs_[order_minus_1];
+ if(prune_thresholds_[order_minus_1 + 1] > 0) {
+ //Compute hash value for current context
+ uint64_t current_hash = util::MurmurHashNative(gram.begin(), gram.Order() * sizeof(WordIndex));
+
+ const HashGamma *hashed_backoff = static_cast<const HashGamma*>(backoffs_[order_minus_1].Get());
+ while(current_hash != hashed_backoff->hash_value && ++backoffs_[order_minus_1])
+ hashed_backoff = static_cast<const HashGamma*>(backoffs_[order_minus_1].Get());
+
+ if(current_hash == hashed_backoff->hash_value) {
+ out_backoff = hashed_backoff->gamma;
+ ++backoffs_[order_minus_1];
+ } else {
+ // Has been pruned away so it is not a context anymore
+ out_backoff = 1.0;
+ }
+ } else {
+ out_backoff = *static_cast<const float*>(backoffs_[order_minus_1].Get());
+ ++backoffs_[order_minus_1];
+ }
} else {
- // Not a context.
- pay.complete.backoff = 0.0;
+ // Not a context.
+ out_backoff = 1.0;
}
+
+ output_.Gram(order_minus_1, out_backoff, pay.complete);
}
void Exit(unsigned, const NGram &) const {}
private:
- FixedArray<util::stream::Stream> backoffs_;
+ util::FixedArray<util::stream::Stream> backoffs_;
std::vector<float> probs_;
+ const std::vector<uint64_t>& prune_thresholds_;
+
+ Output output_;
};
} // namespace
-Interpolate::Interpolate(uint64_t unigram_count, const ChainPositions &backoffs)
- : uniform_prob_(1.0 / static_cast<float>(unigram_count - 1)), backoffs_(backoffs) {}
+Interpolate::Interpolate(uint64_t vocab_size, const util::stream::ChainPositions &backoffs, const std::vector<uint64_t>& prune_thresholds, bool output_q)
+ : uniform_prob_(1.0 / static_cast<float>(vocab_size)), // Includes <unk> but excludes <s>.
+ backoffs_(backoffs),
+ prune_thresholds_(prune_thresholds),
+ output_q_(output_q) {}
// perform order-wise interpolation
-void Interpolate::Run(const ChainPositions &positions) {
+void Interpolate::Run(const util::stream::ChainPositions &positions) {
assert(positions.size() == backoffs_.size() + 1);
- Callback callback(uniform_prob_, backoffs_);
- JointOrder<Callback, SuffixOrder>(positions, callback);
+ if (output_q_) {
+ typedef Callback<OutputQ> C;
+ C callback(uniform_prob_, backoffs_, prune_thresholds_);
+ JointOrder<C, SuffixOrder>(positions, callback);
+ } else {
+ typedef Callback<OutputProbBackoff> C;
+ C callback(uniform_prob_, backoffs_, prune_thresholds_);
+ JointOrder<C, SuffixOrder>(positions, callback);
+ }
}
}} // namespaces
diff --git a/klm/lm/builder/interpolate.hh b/klm/lm/builder/interpolate.hh
index 9268d404..0acece92 100644
--- a/klm/lm/builder/interpolate.hh
+++ b/klm/lm/builder/interpolate.hh
@@ -1,9 +1,11 @@
-#ifndef LM_BUILDER_INTERPOLATE__
-#define LM_BUILDER_INTERPOLATE__
+#ifndef LM_BUILDER_INTERPOLATE_H
+#define LM_BUILDER_INTERPOLATE_H
-#include <stdint.h>
+#include "util/stream/multi_stream.hh"
+
+#include <vector>
-#include "lm/builder/multi_stream.hh"
+#include <stdint.h>
namespace lm { namespace builder {
@@ -14,14 +16,18 @@ namespace lm { namespace builder {
*/
class Interpolate {
public:
- explicit Interpolate(uint64_t unigram_count, const ChainPositions &backoffs);
+ // Normally vocab_size is the unigram count-1 (since p(<s>) = 0) but might
+ // be larger when the user specifies a consistent vocabulary size.
+ explicit Interpolate(uint64_t vocab_size, const util::stream::ChainPositions &backoffs, const std::vector<uint64_t> &prune_thresholds, bool output_q_);
- void Run(const ChainPositions &positions);
+ void Run(const util::stream::ChainPositions &positions);
private:
float uniform_prob_;
- ChainPositions backoffs_;
+ util::stream::ChainPositions backoffs_;
+ const std::vector<uint64_t> prune_thresholds_;
+ bool output_q_;
};
}} // namespaces
-#endif // LM_BUILDER_INTERPOLATE__
+#endif // LM_BUILDER_INTERPOLATE_H
diff --git a/klm/lm/builder/joint_order.hh b/klm/lm/builder/joint_order.hh
index b5620144..7235d4f7 100644
--- a/klm/lm/builder/joint_order.hh
+++ b/klm/lm/builder/joint_order.hh
@@ -1,14 +1,14 @@
-#ifndef LM_BUILDER_JOINT_ORDER__
-#define LM_BUILDER_JOINT_ORDER__
+#ifndef LM_BUILDER_JOINT_ORDER_H
+#define LM_BUILDER_JOINT_ORDER_H
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "lm/lm_exception.hh"
#include <string.h>
namespace lm { namespace builder {
-template <class Callback, class Compare> void JointOrder(const ChainPositions &positions, Callback &callback) {
+template <class Callback, class Compare> void JointOrder(const util::stream::ChainPositions &positions, Callback &callback) {
// Allow matching to reference streams[-1].
NGramStreams streams_with_dummy;
streams_with_dummy.InitWithDummy(positions);
@@ -40,4 +40,4 @@ template <class Callback, class Compare> void JointOrder(const ChainPositions &p
}} // namespaces
-#endif // LM_BUILDER_JOINT_ORDER__
+#endif // LM_BUILDER_JOINT_ORDER_H
diff --git a/klm/lm/builder/lmplz_main.cc b/klm/lm/builder/lmplz_main.cc
index 2563deed..265dd216 100644
--- a/klm/lm/builder/lmplz_main.cc
+++ b/klm/lm/builder/lmplz_main.cc
@@ -1,4 +1,5 @@
#include "lm/builder/pipeline.hh"
+#include "lm/lm_exception.hh"
#include "util/file.hh"
#include "util/file_piece.hh"
#include "util/usage.hh"
@@ -7,6 +8,7 @@
#include <boost/program_options.hpp>
#include <boost/version.hpp>
+#include <vector>
namespace {
class SizeNotify {
@@ -25,6 +27,57 @@ boost::program_options::typed_value<std::string> *SizeOption(std::size_t &to, co
return boost::program_options::value<std::string>()->notifier(SizeNotify(to))->default_value(default_value);
}
+// Parse and validate pruning thresholds then return vector of threshold counts
+// for each n-grams order.
+std::vector<uint64_t> ParsePruning(const std::vector<std::string> &param, std::size_t order) {
+ // convert to vector of integers
+ std::vector<uint64_t> prune_thresholds;
+ prune_thresholds.reserve(order);
+ for (std::vector<std::string>::const_iterator it(param.begin()); it != param.end(); ++it) {
+ try {
+ prune_thresholds.push_back(boost::lexical_cast<uint64_t>(*it));
+ } catch(const boost::bad_lexical_cast &) {
+ UTIL_THROW(util::Exception, "Bad pruning threshold " << *it);
+ }
+ }
+
+ // Fill with zeros by default.
+ if (prune_thresholds.empty()) {
+ prune_thresholds.resize(order, 0);
+ return prune_thresholds;
+ }
+
+ // validate pruning threshold if specified
+ // throw if each n-gram order has not threshold specified
+ UTIL_THROW_IF(prune_thresholds.size() > order, util::Exception, "You specified pruning thresholds for orders 1 through " << prune_thresholds.size() << " but the model only has order " << order);
+ // threshold for unigram can only be 0 (no pruning)
+ UTIL_THROW_IF(prune_thresholds[0] != 0, util::Exception, "Unigram pruning is not implemented, so the first pruning threshold must be 0.");
+
+ // check if threshold are not in decreasing order
+ uint64_t lower_threshold = 0;
+ for (std::vector<uint64_t>::iterator it = prune_thresholds.begin(); it != prune_thresholds.end(); ++it) {
+ UTIL_THROW_IF(lower_threshold > *it, util::Exception, "Pruning thresholds should be in non-decreasing order. Otherwise substrings would be removed, which is bad for query-time data structures.");
+ lower_threshold = *it;
+ }
+
+ // Pad to all orders using the last value.
+ prune_thresholds.resize(order, prune_thresholds.back());
+ return prune_thresholds;
+}
+
+lm::builder::Discount ParseDiscountFallback(const std::vector<std::string> &param) {
+ lm::builder::Discount ret;
+ UTIL_THROW_IF(param.size() > 3, util::Exception, "Specify at most three fallback discounts: 1, 2, and 3+");
+ UTIL_THROW_IF(param.empty(), util::Exception, "Fallback discounting enabled, but no discount specified");
+ ret.amount[0] = 0.0;
+ for (unsigned i = 0; i < 3; ++i) {
+ float discount = boost::lexical_cast<float>(param[i < param.size() ? i : (param.size() - 1)]);
+ UTIL_THROW_IF(discount < 0.0 || discount > static_cast<float>(i+1), util::Exception, "The discount for count " << (i+1) << " was parsed as " << discount << " which is not in the range [0, " << (i+1) << "].");
+ ret.amount[i + 1] = discount;
+ }
+ return ret;
+}
+
} // namespace
int main(int argc, char *argv[]) {
@@ -34,25 +87,36 @@ int main(int argc, char *argv[]) {
lm::builder::PipelineConfig pipeline;
std::string text, arpa;
+ std::vector<std::string> pruning;
+ std::vector<std::string> discount_fallback;
+ std::vector<std::string> discount_fallback_default;
+ discount_fallback_default.push_back("0.5");
+ discount_fallback_default.push_back("1");
+ discount_fallback_default.push_back("1.5");
options.add_options()
- ("help", po::bool_switch(), "Show this help message")
+ ("help,h", po::bool_switch(), "Show this help message")
("order,o", po::value<std::size_t>(&pipeline.order)
#if BOOST_VERSION >= 104200
->required()
#endif
, "Order of the model")
- ("interpolate_unigrams", po::bool_switch(&pipeline.initial_probs.interpolate_unigrams), "Interpolate the unigrams (default: emulate SRILM by not interpolating)")
+ ("interpolate_unigrams", po::value<bool>(&pipeline.initial_probs.interpolate_unigrams)->default_value(true)->implicit_value(true), "Interpolate the unigrams (default) as opposed to giving lots of mass to <unk> like SRI. If you want SRI's behavior with a large <unk> and the old lmplz default, use --interpolate_unigrams 0.")
+ ("skip_symbols", po::bool_switch(), "Treat <s>, </s>, and <unk> as whitespace instead of throwing an exception")
("temp_prefix,T", po::value<std::string>(&pipeline.sort.temp_prefix)->default_value("/tmp/lm"), "Temporary file prefix")
("memory,S", SizeOption(pipeline.sort.total_memory, util::GuessPhysicalMemory() ? "80%" : "1G"), "Sorting memory")
("minimum_block", SizeOption(pipeline.minimum_block, "8K"), "Minimum block size to allow")
("sort_block", SizeOption(pipeline.sort.buffer_size, "64M"), "Size of IO operations for sort (determines arity)")
- ("vocab_estimate", po::value<lm::WordIndex>(&pipeline.vocab_estimate)->default_value(1000000), "Assume this vocabulary size for purposes of calculating memory in step 1 (corpus count) and pre-sizing the hash table")
("block_count", po::value<std::size_t>(&pipeline.block_count)->default_value(2), "Block count (per order)")
- ("vocab_file", po::value<std::string>(&pipeline.vocab_file)->default_value(""), "Location to write vocabulary file")
+ ("vocab_estimate", po::value<lm::WordIndex>(&pipeline.vocab_estimate)->default_value(1000000), "Assume this vocabulary size for purposes of calculating memory in step 1 (corpus count) and pre-sizing the hash table")
+ ("vocab_file", po::value<std::string>(&pipeline.vocab_file)->default_value(""), "Location to write a file containing the unique vocabulary strings delimited by null bytes")
+ ("vocab_pad", po::value<uint64_t>(&pipeline.vocab_size_for_unk)->default_value(0), "If the vocabulary is smaller than this value, pad with <unk> to reach this size. Requires --interpolate_unigrams")
("verbose_header", po::bool_switch(&pipeline.verbose_header), "Add a verbose header to the ARPA file that includes information such as token count, smoothing type, etc.")
("text", po::value<std::string>(&text), "Read text from a file instead of stdin")
- ("arpa", po::value<std::string>(&arpa), "Write ARPA to a file instead of stdout");
+ ("arpa", po::value<std::string>(&arpa), "Write ARPA to a file instead of stdout")
+ ("collapse_values", po::bool_switch(&pipeline.output_q), "Collapse probability and backoff into a single value, q that yields the same sentence-level probabilities. See http://kheafield.com/professional/edinburgh/rest_paper.pdf for more details, including a proof.")
+ ("prune", po::value<std::vector<std::string> >(&pruning)->multitoken(), "Prune n-grams with count less than or equal to the given threshold. Specify one value for each order i.e. 0 0 1 to prune singleton trigrams and above. The sequence of values must be non-decreasing and the last value applies to any remaining orders. Unigram pruning is not implemented, so the first value must be zero. Default is to not prune, which is equivalent to --prune 0.")
+ ("discount_fallback", po::value<std::vector<std::string> >(&discount_fallback)->multitoken()->implicit_value(discount_fallback_default, "0.5 1 1.5"), "The closed-form estimate for Kneser-Ney discounts does not work without singletons or doubletons. It can also fail if these values are out of range. This option falls back to user-specified discounts when the closed-form estimate fails. Note that this option is generally a bad idea: you should deduplicate your corpus instead. However, class-based models need custom discounts because they lack singleton unigrams. Provide up to three discounts (for adjusted counts 1, 2, and 3+), which will be applied to all orders where the closed-form estimates fail.");
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, options), vm);
@@ -95,6 +159,29 @@ int main(int argc, char *argv[]) {
}
#endif
+ if (pipeline.vocab_size_for_unk && !pipeline.initial_probs.interpolate_unigrams) {
+ std::cerr << "--vocab_pad requires --interpolate_unigrams be on" << std::endl;
+ return 1;
+ }
+
+ if (vm["skip_symbols"].as<bool>()) {
+ pipeline.disallowed_symbol_action = lm::COMPLAIN;
+ } else {
+ pipeline.disallowed_symbol_action = lm::THROW_UP;
+ }
+
+ if (vm.count("discount_fallback")) {
+ pipeline.discount.fallback = ParseDiscountFallback(discount_fallback);
+ pipeline.discount.bad_action = lm::COMPLAIN;
+ } else {
+ // Unused, just here to prevent the compiler from complaining about uninitialized.
+ pipeline.discount.fallback = lm::builder::Discount();
+ pipeline.discount.bad_action = lm::THROW_UP;
+ }
+
+ // parse pruning thresholds. These depend on order, so it is not done as a notifier.
+ pipeline.prune_thresholds = ParsePruning(pruning, pipeline.order);
+
util::NormalizeTempPrefix(pipeline.sort.temp_prefix);
lm::builder::InitialProbabilitiesConfig &initial = pipeline.initial_probs;
diff --git a/klm/lm/builder/ngram.hh b/klm/lm/builder/ngram.hh
index f5681516..0472bcb1 100644
--- a/klm/lm/builder/ngram.hh
+++ b/klm/lm/builder/ngram.hh
@@ -1,5 +1,5 @@
-#ifndef LM_BUILDER_NGRAM__
-#define LM_BUILDER_NGRAM__
+#ifndef LM_BUILDER_NGRAM_H
+#define LM_BUILDER_NGRAM_H
#include "lm/weights.hh"
#include "lm/word_index.hh"
@@ -26,7 +26,7 @@ union Payload {
class NGram {
public:
- NGram(void *begin, std::size_t order)
+ NGram(void *begin, std::size_t order)
: begin_(static_cast<WordIndex*>(begin)), end_(begin_ + order) {}
const uint8_t *Base() const { return reinterpret_cast<const uint8_t*>(begin_); }
@@ -38,12 +38,12 @@ class NGram {
end_ = begin_ + difference;
}
- // Would do operator++ but that can get confusing for a stream.
+ // Would do operator++ but that can get confusing for a stream.
void NextInMemory() {
ReBase(&Value() + 1);
}
- // Lower-case in deference to STL.
+ // Lower-case in deference to STL.
const WordIndex *begin() const { return begin_; }
WordIndex *begin() { return begin_; }
const WordIndex *end() const { return end_; }
@@ -61,7 +61,7 @@ class NGram {
return order * sizeof(WordIndex) + sizeof(Payload);
}
std::size_t TotalSize() const {
- // Compiler should optimize this.
+ // Compiler should optimize this.
return TotalSize(Order());
}
static std::size_t OrderFromSize(std::size_t size) {
@@ -69,6 +69,31 @@ class NGram {
assert(size == TotalSize(ret));
return ret;
}
+
+ // manipulate msb to signal that ngram can be pruned
+ /*mjd**********************************************************************/
+
+ bool IsMarked() const {
+ return Value().count >> (sizeof(Value().count) * 8 - 1);
+ }
+
+ void Mark() {
+ Value().count |= (1ul << (sizeof(Value().count) * 8 - 1));
+ }
+
+ void Unmark() {
+ Value().count &= ~(1ul << (sizeof(Value().count) * 8 - 1));
+ }
+
+ uint64_t UnmarkedCount() const {
+ return Value().count & ~(1ul << (sizeof(Value().count) * 8 - 1));
+ }
+
+ uint64_t CutoffCount() const {
+ return IsMarked() ? 0 : UnmarkedCount();
+ }
+
+ /*mjd**********************************************************************/
private:
WordIndex *begin_, *end_;
@@ -81,4 +106,4 @@ const WordIndex kEOS = 2;
} // namespace builder
} // namespace lm
-#endif // LM_BUILDER_NGRAM__
+#endif // LM_BUILDER_NGRAM_H
diff --git a/klm/lm/builder/ngram_stream.hh b/klm/lm/builder/ngram_stream.hh
index 3c994664..ab42734c 100644
--- a/klm/lm/builder/ngram_stream.hh
+++ b/klm/lm/builder/ngram_stream.hh
@@ -1,8 +1,9 @@
-#ifndef LM_BUILDER_NGRAM_STREAM__
-#define LM_BUILDER_NGRAM_STREAM__
+#ifndef LM_BUILDER_NGRAM_STREAM_H
+#define LM_BUILDER_NGRAM_STREAM_H
#include "lm/builder/ngram.hh"
#include "util/stream/chain.hh"
+#include "util/stream/multi_stream.hh"
#include "util/stream/stream.hh"
#include <cstddef>
@@ -51,5 +52,7 @@ inline util::stream::Chain &operator>>(util::stream::Chain &chain, NGramStream &
return chain;
}
+typedef util::stream::GenericStreams<NGramStream> NGramStreams;
+
}} // namespaces
-#endif // LM_BUILDER_NGRAM_STREAM__
+#endif // LM_BUILDER_NGRAM_STREAM_H
diff --git a/klm/lm/builder/pipeline.cc b/klm/lm/builder/pipeline.cc
index 44a2313c..21064ab3 100644
--- a/klm/lm/builder/pipeline.cc
+++ b/klm/lm/builder/pipeline.cc
@@ -2,6 +2,7 @@
#include "lm/builder/adjust_counts.hh"
#include "lm/builder/corpus_count.hh"
+#include "lm/builder/hash_gamma.hh"
#include "lm/builder/initial_probabilities.hh"
#include "lm/builder/interpolate.hh"
#include "lm/builder/print.hh"
@@ -20,10 +21,13 @@
namespace lm { namespace builder {
namespace {
-void PrintStatistics(const std::vector<uint64_t> &counts, const std::vector<Discount> &discounts) {
+void PrintStatistics(const std::vector<uint64_t> &counts, const std::vector<uint64_t> &counts_pruned, const std::vector<Discount> &discounts) {
std::cerr << "Statistics:\n";
for (size_t i = 0; i < counts.size(); ++i) {
- std::cerr << (i + 1) << ' ' << counts[i];
+ std::cerr << (i + 1) << ' ' << counts_pruned[i];
+ if(counts[i] != counts_pruned[i])
+ std::cerr << "/" << counts[i];
+
for (size_t d = 1; d <= 3; ++d)
std::cerr << " D" << d << (d == 3 ? "+=" : "=") << discounts[i].amount[d];
std::cerr << '\n';
@@ -39,7 +43,7 @@ class Master {
const PipelineConfig &Config() const { return config_; }
- Chains &MutableChains() { return chains_; }
+ util::stream::Chains &MutableChains() { return chains_; }
template <class T> Master &operator>>(const T &worker) {
chains_ >> worker;
@@ -64,7 +68,7 @@ class Master {
}
// For initial probabilities, but this is generic.
- void SortAndReadTwice(const std::vector<uint64_t> &counts, Sorts<ContextOrder> &sorts, Chains &second, util::stream::ChainConfig second_config) {
+ void SortAndReadTwice(const std::vector<uint64_t> &counts, Sorts<ContextOrder> &sorts, util::stream::Chains &second, util::stream::ChainConfig second_config) {
// Do merge first before allocating chain memory.
for (std::size_t i = 1; i < config_.order; ++i) {
sorts[i - 1].Merge(0);
@@ -198,9 +202,9 @@ class Master {
PipelineConfig config_;
- Chains chains_;
+ util::stream::Chains chains_;
// Often only unigrams, but sometimes all orders.
- FixedArray<util::stream::FileBuffer> files_;
+ util::FixedArray<util::stream::FileBuffer> files_;
};
void CountText(int text_file /* input */, int vocab_file /* output */, Master &master, uint64_t &token_count, std::string &text_file_name) {
@@ -221,7 +225,7 @@ void CountText(int text_file /* input */, int vocab_file /* output */, Master &m
WordIndex type_count = config.vocab_estimate;
util::FilePiece text(text_file, NULL, &std::cerr);
text_file_name = text.FileName();
- CorpusCount counter(text, vocab_file, token_count, type_count, chain.BlockSize() / chain.EntrySize());
+ CorpusCount counter(text, vocab_file, token_count, type_count, chain.BlockSize() / chain.EntrySize(), config.disallowed_symbol_action);
chain >> boost::ref(counter);
util::stream::Sort<SuffixOrder, AddCombiner> sorter(chain, config.sort, SuffixOrder(config.order), AddCombiner());
@@ -231,21 +235,22 @@ void CountText(int text_file /* input */, int vocab_file /* output */, Master &m
master.InitForAdjust(sorter, type_count);
}
-void InitialProbabilities(const std::vector<uint64_t> &counts, const std::vector<Discount> &discounts, Master &master, Sorts<SuffixOrder> &primary, FixedArray<util::stream::FileBuffer> &gammas) {
+void InitialProbabilities(const std::vector<uint64_t> &counts, const std::vector<uint64_t> &counts_pruned, const std::vector<Discount> &discounts, Master &master, Sorts<SuffixOrder> &primary,
+ util::FixedArray<util::stream::FileBuffer> &gammas, const std::vector<uint64_t> &prune_thresholds) {
const PipelineConfig &config = master.Config();
- Chains second(config.order);
+ util::stream::Chains second(config.order);
{
Sorts<ContextOrder> sorts;
master.SetupSorts(sorts);
- PrintStatistics(counts, discounts);
- lm::ngram::ShowSizes(counts);
+ PrintStatistics(counts, counts_pruned, discounts);
+ lm::ngram::ShowSizes(counts_pruned);
std::cerr << "=== 3/5 Calculating and sorting initial probabilities ===" << std::endl;
- master.SortAndReadTwice(counts, sorts, second, config.initial_probs.adder_in);
+ master.SortAndReadTwice(counts_pruned, sorts, second, config.initial_probs.adder_in);
}
- Chains gamma_chains(config.order);
- InitialProbabilities(config.initial_probs, discounts, master.MutableChains(), second, gamma_chains);
+ util::stream::Chains gamma_chains(config.order);
+ InitialProbabilities(config.initial_probs, discounts, master.MutableChains(), second, gamma_chains, prune_thresholds);
// Don't care about gamma for 0.
gamma_chains[0] >> util::stream::kRecycle;
gammas.Init(config.order - 1);
@@ -257,19 +262,25 @@ void InitialProbabilities(const std::vector<uint64_t> &counts, const std::vector
master.SetupSorts(primary);
}
-void InterpolateProbabilities(const std::vector<uint64_t> &counts, Master &master, Sorts<SuffixOrder> &primary, FixedArray<util::stream::FileBuffer> &gammas) {
+void InterpolateProbabilities(const std::vector<uint64_t> &counts, Master &master, Sorts<SuffixOrder> &primary, util::FixedArray<util::stream::FileBuffer> &gammas) {
std::cerr << "=== 4/5 Calculating and writing order-interpolated probabilities ===" << std::endl;
const PipelineConfig &config = master.Config();
master.MaximumLazyInput(counts, primary);
- Chains gamma_chains(config.order - 1);
- util::stream::ChainConfig read_backoffs(config.read_backoffs);
- read_backoffs.entry_size = sizeof(float);
+ util::stream::Chains gamma_chains(config.order - 1);
for (std::size_t i = 0; i < config.order - 1; ++i) {
+ util::stream::ChainConfig read_backoffs(config.read_backoffs);
+
+ // Add 1 because here we are skipping unigrams
+ if(config.prune_thresholds[i + 1] > 0)
+ read_backoffs.entry_size = sizeof(HashGamma);
+ else
+ read_backoffs.entry_size = sizeof(float);
+
gamma_chains.push_back(read_backoffs);
gamma_chains.back() >> gammas[i].Source();
}
- master >> Interpolate(counts[0], ChainPositions(gamma_chains));
+ master >> Interpolate(std::max(master.Config().vocab_size_for_unk, counts[0] - 1 /* <s> is not included */), util::stream::ChainPositions(gamma_chains), config.prune_thresholds, config.output_q);
gamma_chains >> util::stream::kRecycle;
master.BufferFinal(counts);
}
@@ -291,32 +302,40 @@ void Pipeline(PipelineConfig config, int text_file, int out_arpa) {
"Not enough memory to fit " << (config.order * config.block_count) << " blocks with minimum size " << config.minimum_block << ". Increase memory to " << (config.minimum_block * config.order * config.block_count) << " bytes or decrease the minimum block size.");
UTIL_TIMER("(%w s) Total wall time elapsed\n");
- Master master(config);
-
- util::scoped_fd vocab_file(config.vocab_file.empty() ?
- util::MakeTemp(config.TempPrefix()) :
- util::CreateOrThrow(config.vocab_file.c_str()));
- uint64_t token_count;
- std::string text_file_name;
- CountText(text_file, vocab_file.get(), master, token_count, text_file_name);
- std::vector<uint64_t> counts;
- std::vector<Discount> discounts;
- master >> AdjustCounts(counts, discounts);
+ Master master(config);
+ // master's destructor will wait for chains. But they might be deadlocked if
+ // this thread dies because e.g. it ran out of memory.
+ try {
+ util::scoped_fd vocab_file(config.vocab_file.empty() ?
+ util::MakeTemp(config.TempPrefix()) :
+ util::CreateOrThrow(config.vocab_file.c_str()));
+ uint64_t token_count;
+ std::string text_file_name;
+ CountText(text_file, vocab_file.get(), master, token_count, text_file_name);
+
+ std::vector<uint64_t> counts;
+ std::vector<uint64_t> counts_pruned;
+ std::vector<Discount> discounts;
+ master >> AdjustCounts(config.prune_thresholds, counts, counts_pruned, config.discount, discounts);
+
+ {
+ util::FixedArray<util::stream::FileBuffer> gammas;
+ Sorts<SuffixOrder> primary;
+ InitialProbabilities(counts, counts_pruned, discounts, master, primary, gammas, config.prune_thresholds);
+ InterpolateProbabilities(counts_pruned, master, primary, gammas);
+ }
- {
- FixedArray<util::stream::FileBuffer> gammas;
- Sorts<SuffixOrder> primary;
- InitialProbabilities(counts, discounts, master, primary, gammas);
- InterpolateProbabilities(counts, master, primary, gammas);
+ std::cerr << "=== 5/5 Writing ARPA model ===" << std::endl;
+ VocabReconstitute vocab(vocab_file.get());
+ UTIL_THROW_IF(vocab.Size() != counts[0], util::Exception, "Vocab words don't match up. Is there a null byte in the input?");
+ HeaderInfo header_info(text_file_name, token_count);
+ master >> PrintARPA(vocab, counts_pruned, (config.verbose_header ? &header_info : NULL), out_arpa) >> util::stream::kRecycle;
+ master.MutableChains().Wait(true);
+ } catch (const util::Exception &e) {
+ std::cerr << e.what() << std::endl;
+ abort();
}
-
- std::cerr << "=== 5/5 Writing ARPA model ===" << std::endl;
- VocabReconstitute vocab(vocab_file.get());
- UTIL_THROW_IF(vocab.Size() != counts[0], util::Exception, "Vocab words don't match up. Is there a null byte in the input?");
- HeaderInfo header_info(text_file_name, token_count);
- master >> PrintARPA(vocab, counts, (config.verbose_header ? &header_info : NULL), out_arpa) >> util::stream::kRecycle;
- master.MutableChains().Wait(true);
}
}} // namespaces
diff --git a/klm/lm/builder/pipeline.hh b/klm/lm/builder/pipeline.hh
index 845e5481..09e1a4d5 100644
--- a/klm/lm/builder/pipeline.hh
+++ b/klm/lm/builder/pipeline.hh
@@ -1,8 +1,10 @@
-#ifndef LM_BUILDER_PIPELINE__
-#define LM_BUILDER_PIPELINE__
+#ifndef LM_BUILDER_PIPELINE_H
+#define LM_BUILDER_PIPELINE_H
+#include "lm/builder/adjust_counts.hh"
#include "lm/builder/initial_probabilities.hh"
#include "lm/builder/header_info.hh"
+#include "lm/lm_exception.hh"
#include "lm/word_index.hh"
#include "util/stream/config.hh"
#include "util/file_piece.hh"
@@ -18,6 +20,8 @@ struct PipelineConfig {
util::stream::SortConfig sort;
InitialProbabilitiesConfig initial_probs;
util::stream::ChainConfig read_backoffs;
+
+ // Include a header in the ARPA with some statistics?
bool verbose_header;
// Estimated vocabulary size. Used for sizing CorpusCount memory and
@@ -30,6 +34,34 @@ struct PipelineConfig {
// Number of blocks to use. This will be overridden to 1 if everything fits.
std::size_t block_count;
+ // n-gram count thresholds for pruning. 0 values means no pruning for
+ // corresponding n-gram order
+ std::vector<uint64_t> prune_thresholds; //mjd
+
+ // What to do with discount failures.
+ DiscountConfig discount;
+
+ // Compute collapsed q values instead of probability and backoff
+ bool output_q;
+
+ /* Computing the perplexity of LMs with different vocabularies is hard. For
+ * example, the lowest perplexity is attained by a unigram model that
+ * predicts p(<unk>) = 1 and has no other vocabulary. Also, linearly
+ * interpolated models will sum to more than 1 because <unk> is duplicated
+ * (SRI just pretends p(<unk>) = 0 for these purposes, which makes it sum to
+ * 1 but comes with its own problems). This option will make the vocabulary
+ * a particular size by replicating <unk> multiple times for purposes of
+ * computing vocabulary size. It has no effect if the actual vocabulary is
+ * larger. This parameter serves the same purpose as IRSTLM's "dub".
+ */
+ uint64_t vocab_size_for_unk;
+
+ /* What to do the first time <s>, </s>, or <unk> appears in the input. If
+ * this is anything but THROW_UP, then the symbol will always be treated as
+ * whitespace.
+ */
+ WarningAction disallowed_symbol_action;
+
const std::string &TempPrefix() const { return sort.temp_prefix; }
std::size_t TotalMemory() const { return sort.total_memory; }
};
@@ -38,4 +70,4 @@ struct PipelineConfig {
void Pipeline(PipelineConfig config, int text_file, int out_arpa);
}} // namespaces
-#endif // LM_BUILDER_PIPELINE__
+#endif // LM_BUILDER_PIPELINE_H
diff --git a/klm/lm/builder/print.cc b/klm/lm/builder/print.cc
index 84bd81ca..aee6e134 100644
--- a/klm/lm/builder/print.cc
+++ b/klm/lm/builder/print.cc
@@ -42,22 +42,22 @@ PrintARPA::PrintARPA(const VocabReconstitute &vocab, const std::vector<uint64_t>
util::WriteOrThrow(out_fd, as_string.data(), as_string.size());
}
-void PrintARPA::Run(const ChainPositions &positions) {
+void PrintARPA::Run(const util::stream::ChainPositions &positions) {
util::scoped_fd closer(out_fd_);
UTIL_TIMER("(%w s) Wrote ARPA file\n");
util::FakeOFStream out(out_fd_);
for (unsigned order = 1; order <= positions.size(); ++order) {
out << "\\" << order << "-grams:" << '\n';
for (NGramStream stream(positions[order - 1]); stream; ++stream) {
- // Correcting for numerical precision issues. Take that IRST.
- out << std::min(0.0f, stream->Value().complete.prob) << '\t' << vocab_.Lookup(*stream->begin());
+ // Correcting for numerical precision issues. Take that IRST.
+ out << stream->Value().complete.prob << '\t' << vocab_.Lookup(*stream->begin());
for (const WordIndex *i = stream->begin() + 1; i != stream->end(); ++i) {
out << ' ' << vocab_.Lookup(*i);
}
- float backoff = stream->Value().complete.backoff;
- if (backoff != 0.0)
- out << '\t' << backoff;
+ if (order != positions.size())
+ out << '\t' << stream->Value().complete.backoff;
out << '\n';
+
}
out << '\n';
}
diff --git a/klm/lm/builder/print.hh b/klm/lm/builder/print.hh
index adbbb94a..9856cea8 100644
--- a/klm/lm/builder/print.hh
+++ b/klm/lm/builder/print.hh
@@ -1,8 +1,8 @@
-#ifndef LM_BUILDER_PRINT__
-#define LM_BUILDER_PRINT__
+#ifndef LM_BUILDER_PRINT_H
+#define LM_BUILDER_PRINT_H
#include "lm/builder/ngram.hh"
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "lm/builder/header_info.hh"
#include "util/file.hh"
#include "util/mmap.hh"
@@ -59,7 +59,7 @@ template <class V> class Print {
public:
explicit Print(const VocabReconstitute &vocab, std::ostream &to) : vocab_(vocab), to_(to) {}
- void Run(const ChainPositions &chains) {
+ void Run(const util::stream::ChainPositions &chains) {
NGramStreams streams(chains);
for (NGramStream *s = streams.begin(); s != streams.end(); ++s) {
DumpStream(*s);
@@ -92,7 +92,7 @@ class PrintARPA {
// Takes ownership of out_fd upon Run().
explicit PrintARPA(const VocabReconstitute &vocab, const std::vector<uint64_t> &counts, const HeaderInfo* header_info, int out_fd);
- void Run(const ChainPositions &positions);
+ void Run(const util::stream::ChainPositions &positions);
private:
const VocabReconstitute &vocab_;
@@ -100,4 +100,4 @@ class PrintARPA {
};
}} // namespaces
-#endif // LM_BUILDER_PRINT__
+#endif // LM_BUILDER_PRINT_H
diff --git a/klm/lm/builder/sort.hh b/klm/lm/builder/sort.hh
index 9989389b..712bb8e3 100644
--- a/klm/lm/builder/sort.hh
+++ b/klm/lm/builder/sort.hh
@@ -1,7 +1,7 @@
-#ifndef LM_BUILDER_SORT__
-#define LM_BUILDER_SORT__
+#ifndef LM_BUILDER_SORT_H
+#define LM_BUILDER_SORT_H
-#include "lm/builder/multi_stream.hh"
+#include "lm/builder/ngram_stream.hh"
#include "lm/builder/ngram.hh"
#include "lm/word_index.hh"
#include "util/stream/sort.hh"
@@ -14,24 +14,71 @@
namespace lm {
namespace builder {
+/**
+ * Abstract parent class for defining custom n-gram comparators.
+ */
template <class Child> class Comparator : public std::binary_function<const void *, const void *, bool> {
public:
+
+ /**
+ * Constructs a comparator capable of comparing two n-grams.
+ *
+ * @param order Number of words in each n-gram
+ */
explicit Comparator(std::size_t order) : order_(order) {}
+ /**
+ * Applies the comparator using the Compare method that must be defined in any class that inherits from this class.
+ *
+ * @param lhs A pointer to the n-gram on the left-hand side of the comparison
+ * @param rhs A pointer to the n-gram on the right-hand side of the comparison
+ *
+ * @see ContextOrder::Compare
+ * @see PrefixOrder::Compare
+ * @see SuffixOrder::Compare
+ */
inline bool operator()(const void *lhs, const void *rhs) const {
return static_cast<const Child*>(this)->Compare(static_cast<const WordIndex*>(lhs), static_cast<const WordIndex*>(rhs));
}
+ /** Gets the n-gram order defined for this comparator. */
std::size_t Order() const { return order_; }
protected:
std::size_t order_;
};
+/**
+ * N-gram comparator that compares n-grams according to their reverse (suffix) order.
+ *
+ * This comparator compares n-grams lexicographically, one word at a time,
+ * beginning with the last word of each n-gram and ending with the first word of each n-gram.
+ *
+ * Some examples of n-gram comparisons as defined by this comparator:
+ * - a b c == a b c
+ * - a b c < a b d
+ * - a b c > a d b
+ * - a b c > a b b
+ * - a b c > x a c
+ * - a b c < x y z
+ */
class SuffixOrder : public Comparator<SuffixOrder> {
public:
+
+ /**
+ * Constructs a comparator capable of comparing two n-grams.
+ *
+ * @param order Number of words in each n-gram
+ */
explicit SuffixOrder(std::size_t order) : Comparator<SuffixOrder>(order) {}
+ /**
+ * Compares two n-grams lexicographically, one word at a time,
+ * beginning with the last word of each n-gram and ending with the first word of each n-gram.
+ *
+ * @param lhs A pointer to the n-gram on the left-hand side of the comparison
+ * @param rhs A pointer to the n-gram on the right-hand side of the comparison
+ */
inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
for (std::size_t i = order_ - 1; i != 0; --i) {
if (lhs[i] != rhs[i])
@@ -43,10 +90,40 @@ class SuffixOrder : public Comparator<SuffixOrder> {
static const unsigned kMatchOffset = 1;
};
+
+/**
+ * N-gram comparator that compares n-grams according to the reverse (suffix) order of the n-gram context.
+ *
+ * This comparator compares n-grams lexicographically, one word at a time,
+ * beginning with the penultimate word of each n-gram and ending with the first word of each n-gram;
+ * finally, this comparator compares the last word of each n-gram.
+ *
+ * Some examples of n-gram comparisons as defined by this comparator:
+ * - a b c == a b c
+ * - a b c < a b d
+ * - a b c < a d b
+ * - a b c > a b b
+ * - a b c > x a c
+ * - a b c < x y z
+ */
class ContextOrder : public Comparator<ContextOrder> {
public:
+
+ /**
+ * Constructs a comparator capable of comparing two n-grams.
+ *
+ * @param order Number of words in each n-gram
+ */
explicit ContextOrder(std::size_t order) : Comparator<ContextOrder>(order) {}
+ /**
+ * Compares two n-grams lexicographically, one word at a time,
+ * beginning with the penultimate word of each n-gram and ending with the first word of each n-gram;
+ * finally, this comparator compares the last word of each n-gram.
+ *
+ * @param lhs A pointer to the n-gram on the left-hand side of the comparison
+ * @param rhs A pointer to the n-gram on the right-hand side of the comparison
+ */
inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
for (int i = order_ - 2; i >= 0; --i) {
if (lhs[i] != rhs[i])
@@ -56,10 +133,37 @@ class ContextOrder : public Comparator<ContextOrder> {
}
};
+/**
+ * N-gram comparator that compares n-grams according to their natural (prefix) order.
+ *
+ * This comparator compares n-grams lexicographically, one word at a time,
+ * beginning with the first word of each n-gram and ending with the last word of each n-gram.
+ *
+ * Some examples of n-gram comparisons as defined by this comparator:
+ * - a b c == a b c
+ * - a b c < a b d
+ * - a b c < a d b
+ * - a b c > a b b
+ * - a b c < x a c
+ * - a b c < x y z
+ */
class PrefixOrder : public Comparator<PrefixOrder> {
public:
+
+ /**
+ * Constructs a comparator capable of comparing two n-grams.
+ *
+ * @param order Number of words in each n-gram
+ */
explicit PrefixOrder(std::size_t order) : Comparator<PrefixOrder>(order) {}
+ /**
+ * Compares two n-grams lexicographically, one word at a time,
+ * beginning with the first word of each n-gram and ending with the last word of each n-gram.
+ *
+ * @param lhs A pointer to the n-gram on the left-hand side of the comparison
+ * @param rhs A pointer to the n-gram on the right-hand side of the comparison
+ */
inline bool Compare(const WordIndex *lhs, const WordIndex *rhs) const {
for (std::size_t i = 0; i < order_; ++i) {
if (lhs[i] != rhs[i])
@@ -84,15 +188,52 @@ struct AddCombiner {
};
// The combiner is only used on a single chain, so I didn't bother to allow
-// that template.
-template <class Compare> class Sorts : public FixedArray<util::stream::Sort<Compare> > {
+// that template.
+/**
+ * Represents an @ref util::FixedArray "array" capable of storing @ref util::stream::Sort "Sort" objects.
+ *
+ * In the anticipated use case, an instance of this class will maintain one @ref util::stream::Sort "Sort" object
+ * for each n-gram order (ranging from 1 up to the maximum n-gram order being processed).
+ * Use in this manner would enable the n-grams each n-gram order to be sorted, in parallel.
+ *
+ * @tparam Compare An @ref Comparator "ngram comparator" to use during sorting.
+ */
+template <class Compare> class Sorts : public util::FixedArray<util::stream::Sort<Compare> > {
private:
typedef util::stream::Sort<Compare> S;
- typedef FixedArray<S> P;
+ typedef util::FixedArray<S> P;
public:
+
+ /**
+ * Constructs, but does not initialize.
+ *
+ * @ref util::FixedArray::Init() "Init" must be called before use.
+ *
+ * @see util::FixedArray::Init()
+ */
+ Sorts() {}
+
+ /**
+ * Constructs an @ref util::FixedArray "array" capable of storing a fixed number of @ref util::stream::Sort "Sort" objects.
+ *
+ * @param number The maximum number of @ref util::stream::Sort "sorters" that can be held by this @ref util::FixedArray "array"
+ * @see util::FixedArray::FixedArray()
+ */
+ explicit Sorts(std::size_t number) : util::FixedArray<util::stream::Sort<Compare> >(number) {}
+
+ /**
+ * Constructs a new @ref util::stream::Sort "Sort" object which is stored in this @ref util::FixedArray "array".
+ *
+ * The new @ref util::stream::Sort "Sort" object is constructed using the provided @ref util::stream::SortConfig "SortConfig" and @ref Comparator "ngram comparator";
+ * once constructed, a new worker @ref util::stream::Thread "thread" (owned by the @ref util::stream::Chain "chain") will sort the n-gram data stored
+ * in the @ref util::stream::Block "blocks" of the provided @ref util::stream::Chain "chain".
+ *
+ * @see util::stream::Sort::Sort()
+ * @see util::stream::Chain::operator>>()
+ */
void push_back(util::stream::Chain &chain, const util::stream::SortConfig &config, const Compare &compare) {
- new (P::end()) S(chain, config, compare);
+ new (P::end()) S(chain, config, compare); // use "placement new" syntax to initalize S in an already-allocated memory location
P::Constructed();
}
};
@@ -100,4 +241,4 @@ template <class Compare> class Sorts : public FixedArray<util::stream::Sort<Comp
} // namespace builder
} // namespace lm
-#endif // LM_BUILDER_SORT__
+#endif // LM_BUILDER_SORT_H
diff --git a/klm/lm/config.hh b/klm/lm/config.hh
index 0de7b7c6..dab28123 100644
--- a/klm/lm/config.hh
+++ b/klm/lm/config.hh
@@ -1,5 +1,5 @@
-#ifndef LM_CONFIG__
-#define LM_CONFIG__
+#ifndef LM_CONFIG_H
+#define LM_CONFIG_H
#include "lm/lm_exception.hh"
#include "util/mmap.hh"
@@ -120,4 +120,4 @@ struct Config {
} /* namespace ngram */ } /* namespace lm */
-#endif // LM_CONFIG__
+#endif // LM_CONFIG_H
diff --git a/klm/lm/enumerate_vocab.hh b/klm/lm/enumerate_vocab.hh
index 27263621..f5ce7898 100644
--- a/klm/lm/enumerate_vocab.hh
+++ b/klm/lm/enumerate_vocab.hh
@@ -1,5 +1,5 @@
-#ifndef LM_ENUMERATE_VOCAB__
-#define LM_ENUMERATE_VOCAB__
+#ifndef LM_ENUMERATE_VOCAB_H
+#define LM_ENUMERATE_VOCAB_H
#include "lm/word_index.hh"
#include "util/string_piece.hh"
@@ -24,5 +24,5 @@ class EnumerateVocab {
} // namespace lm
-#endif // LM_ENUMERATE_VOCAB__
+#endif // LM_ENUMERATE_VOCAB_H
diff --git a/klm/lm/facade.hh b/klm/lm/facade.hh
index de1551f1..8e12b62e 100644
--- a/klm/lm/facade.hh
+++ b/klm/lm/facade.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FACADE__
-#define LM_FACADE__
+#ifndef LM_FACADE_H
+#define LM_FACADE_H
#include "lm/virtual_interface.hh"
#include "util/string_piece.hh"
@@ -70,4 +70,4 @@ template <class Child, class StateT, class VocabularyT> class ModelFacade : publ
} // mamespace base
} // namespace lm
-#endif // LM_FACADE__
+#endif // LM_FACADE_H
diff --git a/klm/lm/filter/arpa_io.hh b/klm/lm/filter/arpa_io.hh
index 602b5b31..99c97b11 100644
--- a/klm/lm/filter/arpa_io.hh
+++ b/klm/lm/filter/arpa_io.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_ARPA_IO__
-#define LM_FILTER_ARPA_IO__
+#ifndef LM_FILTER_ARPA_IO_H
+#define LM_FILTER_ARPA_IO_H
/* Input and output for ARPA format language model files.
*/
#include "lm/read_arpa.hh"
@@ -111,4 +111,4 @@ template <class Output> void ReadARPA(util::FilePiece &in_lm, Output &out) {
} // namespace lm
-#endif // LM_FILTER_ARPA_IO__
+#endif // LM_FILTER_ARPA_IO_H
diff --git a/klm/lm/filter/count_io.hh b/klm/lm/filter/count_io.hh
index d992026f..de894baf 100644
--- a/klm/lm/filter/count_io.hh
+++ b/klm/lm/filter/count_io.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_COUNT_IO__
-#define LM_FILTER_COUNT_IO__
+#ifndef LM_FILTER_COUNT_IO_H
+#define LM_FILTER_COUNT_IO_H
#include <fstream>
#include <iostream>
@@ -86,4 +86,4 @@ template <class Output> void ReadCount(util::FilePiece &in_file, Output &out) {
} // namespace lm
-#endif // LM_FILTER_COUNT_IO__
+#endif // LM_FILTER_COUNT_IO_H
diff --git a/klm/lm/filter/format.hh b/klm/lm/filter/format.hh
index 7d8c28db..5a2e2db3 100644
--- a/klm/lm/filter/format.hh
+++ b/klm/lm/filter/format.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_FORMAT_H__
-#define LM_FILTER_FORMAT_H__
+#ifndef LM_FILTER_FORMAT_H
+#define LM_FILTER_FORMAT_H
#include "lm/filter/arpa_io.hh"
#include "lm/filter/count_io.hh"
@@ -247,4 +247,4 @@ class MultipleOutputBuffer {
} // namespace lm
-#endif // LM_FILTER_FORMAT_H__
+#endif // LM_FILTER_FORMAT_H
diff --git a/klm/lm/filter/phrase.hh b/klm/lm/filter/phrase.hh
index e8e85835..e5898c9a 100644
--- a/klm/lm/filter/phrase.hh
+++ b/klm/lm/filter/phrase.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_PHRASE_H__
-#define LM_FILTER_PHRASE_H__
+#ifndef LM_FILTER_PHRASE_H
+#define LM_FILTER_PHRASE_H
#include "util/murmur_hash.hh"
#include "util/string_piece.hh"
@@ -165,4 +165,4 @@ class Multiple : public detail::ConditionCommon {
} // namespace phrase
} // namespace lm
-#endif // LM_FILTER_PHRASE_H__
+#endif // LM_FILTER_PHRASE_H
diff --git a/klm/lm/filter/thread.hh b/klm/lm/filter/thread.hh
index e785b263..6a6523f9 100644
--- a/klm/lm/filter/thread.hh
+++ b/klm/lm/filter/thread.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_THREAD_H__
-#define LM_FILTER_THREAD_H__
+#ifndef LM_FILTER_THREAD_H
+#define LM_FILTER_THREAD_H
#include "util/thread_pool.hh"
@@ -164,4 +164,4 @@ template <class Filter, class OutputBuffer, class RealOutput> class Controller :
} // namespace lm
-#endif // LM_FILTER_THREAD_H__
+#endif // LM_FILTER_THREAD_H
diff --git a/klm/lm/filter/vocab.hh b/klm/lm/filter/vocab.hh
index 7f0fadaa..2ee6e1f8 100644
--- a/klm/lm/filter/vocab.hh
+++ b/klm/lm/filter/vocab.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_VOCAB_H__
-#define LM_FILTER_VOCAB_H__
+#ifndef LM_FILTER_VOCAB_H
+#define LM_FILTER_VOCAB_H
// Vocabulary-based filters for language models.
@@ -130,4 +130,4 @@ class Multiple {
} // namespace vocab
} // namespace lm
-#endif // LM_FILTER_VOCAB_H__
+#endif // LM_FILTER_VOCAB_H
diff --git a/klm/lm/filter/wrapper.hh b/klm/lm/filter/wrapper.hh
index eb657501..822c5c27 100644
--- a/klm/lm/filter/wrapper.hh
+++ b/klm/lm/filter/wrapper.hh
@@ -1,5 +1,5 @@
-#ifndef LM_FILTER_WRAPPER_H__
-#define LM_FILTER_WRAPPER_H__
+#ifndef LM_FILTER_WRAPPER_H
+#define LM_FILTER_WRAPPER_H
#include "util/string_piece.hh"
@@ -53,4 +53,4 @@ template <class FilterT> class ContextFilter {
} // namespace lm
-#endif // LM_FILTER_WRAPPER_H__
+#endif // LM_FILTER_WRAPPER_H
diff --git a/klm/lm/interpolate/arpa_to_stream.cc b/klm/lm/interpolate/arpa_to_stream.cc
new file mode 100644
index 00000000..f2696f39
--- /dev/null
+++ b/klm/lm/interpolate/arpa_to_stream.cc
@@ -0,0 +1,47 @@
+#include "lm/interpolate/arpa_to_stream.hh"
+
+// TODO: should this move out of builder?
+#include "lm/builder/ngram_stream.hh"
+#include "lm/read_arpa.hh"
+#include "lm/vocab.hh"
+
+namespace lm { namespace interpolate {
+
+ARPAToStream::ARPAToStream(int fd, ngram::GrowableVocab<ngram::WriteUniqueWords> &vocab)
+ : in_(fd), vocab_(vocab) {
+
+ // Read the ARPA file header.
+ //
+ // After the following call, counts_ will be correctly initialized,
+ // and in_ will be positioned for reading the body of the ARPA file.
+ ReadARPACounts(in_, counts_);
+
+}
+
+void ARPAToStream::Run(const util::stream::ChainPositions &positions) {
+ // Make one stream for each order.
+ builder::NGramStreams streams(positions);
+ PositiveProbWarn warn;
+
+ // Unigrams are handled specially because they're being inserted into the vocab.
+ ReadNGramHeader(in_, 1);
+ for (uint64_t i = 0; i < counts_[0]; ++i, ++streams[0]) {
+ streams[0]->begin()[0] = vocab_.FindOrInsert(Read1Gram(in_, streams[0]->Value().complete, warn));
+ }
+ // Finish off the unigram stream.
+ streams[0].Poison();
+
+ // TODO: don't waste backoff field for highest order.
+ for (unsigned char n = 2; n <= counts_.size(); ++n) {
+ ReadNGramHeader(in_, n);
+ builder::NGramStream &stream = streams[n - 1];
+ const uint64_t end = counts_[n - 1];
+ for (std::size_t i = 0; i < end; ++i, ++stream) {
+ ReadNGram(in_, n, vocab_, stream->begin(), stream->Value().complete, warn);
+ }
+ // Finish the stream for n-grams..
+ stream.Poison();
+ }
+}
+
+}} // namespaces
diff --git a/klm/lm/interpolate/arpa_to_stream.hh b/klm/lm/interpolate/arpa_to_stream.hh
new file mode 100644
index 00000000..4613998d
--- /dev/null
+++ b/klm/lm/interpolate/arpa_to_stream.hh
@@ -0,0 +1,38 @@
+#include "lm/read_arpa.hh"
+#include "util/file_piece.hh"
+
+#include <vector>
+
+#include <stdint.h>
+
+namespace util { namespace stream { class ChainPositions; } }
+
+namespace lm {
+
+namespace ngram {
+template <class T> class GrowableVocab;
+class WriteUniqueWords;
+} // namespace ngram
+
+namespace interpolate {
+
+class ARPAToStream {
+ public:
+ // Takes ownership of fd.
+ explicit ARPAToStream(int fd, ngram::GrowableVocab<ngram::WriteUniqueWords> &vocab);
+
+ std::size_t Order() const { return counts_.size(); }
+
+ const std::vector<uint64_t> &Counts() const { return counts_; }
+
+ void Run(const util::stream::ChainPositions &positions);
+
+ private:
+ util::FilePiece in_;
+
+ std::vector<uint64_t> counts_;
+
+ ngram::GrowableVocab<ngram::WriteUniqueWords> &vocab_;
+};
+
+}} // namespaces
diff --git a/klm/lm/interpolate/example_sort_main.cc b/klm/lm/interpolate/example_sort_main.cc
new file mode 100644
index 00000000..4282255e
--- /dev/null
+++ b/klm/lm/interpolate/example_sort_main.cc
@@ -0,0 +1,144 @@
+#include "lm/interpolate/arpa_to_stream.hh"
+
+#include "lm/builder/print.hh"
+#include "lm/builder/sort.hh"
+#include "lm/vocab.hh"
+#include "util/file.hh"
+#include "util/unistd.hh"
+
+
+int main() {
+
+ // TODO: Make these all command-line parameters
+ const std::size_t ONE_GB = 1 << 30;
+ const std::size_t SIXTY_FOUR_MB = 1 << 26;
+ const std::size_t NUMBER_OF_BLOCKS = 2;
+
+ // Vocab strings will be written to this file, forgotten, and reconstituted
+ // later. This saves memory.
+ util::scoped_fd vocab_file(util::MakeTemp("/tmp/"));
+ std::vector<uint64_t> counts;
+ util::stream::Chains chains;
+ {
+ // Use consistent vocab ids across models.
+ lm::ngram::GrowableVocab<lm::ngram::WriteUniqueWords> vocab(10, vocab_file.get());
+ lm::interpolate::ARPAToStream reader(STDIN_FILENO, vocab);
+ counts = reader.Counts();
+
+ // Configure a chain for each order. TODO: extract chain balance heuristics from lm/builder/pipeline.cc
+ chains.Init(reader.Order());
+
+ for (std::size_t i = 0; i < reader.Order(); ++i) {
+
+ // The following call to chains.push_back() invokes the Chain constructor
+ // and appends the newly created Chain object to the chains array
+ chains.push_back(util::stream::ChainConfig(lm::builder::NGram::TotalSize(i + 1), NUMBER_OF_BLOCKS, ONE_GB));
+
+ }
+
+ // The following call to the >> method of chains
+ // constructs a ChainPosition for each chain in chains using Chain::Add();
+ // that function begins with a call to Chain::Start()
+ // that allocates memory for the chain.
+ //
+ // After the following call to the >> method of chains,
+ // a new thread will be running
+ // and will be executing the reader.Run() method
+ // to read through the body of the ARPA file from standard input.
+ //
+ // For each n-gram line in the ARPA file,
+ // the thread executing reader.Run()
+ // will write the probability, the n-gram, and the backoff
+ // to the appropriate location in the appropriate chain
+ // (for details, see the ReadNGram() method in read_arpa.hh).
+ //
+ // Normally >> copies then runs so inline >> works. But here we want a ref.
+ chains >> boost::ref(reader);
+
+
+ util::stream::SortConfig sort_config;
+ sort_config.temp_prefix = "/tmp/";
+ sort_config.buffer_size = SIXTY_FOUR_MB;
+ sort_config.total_memory = ONE_GB;
+
+ // Parallel sorts across orders (though somewhat limited because ARPA files are not being read in parallel across orders)
+ lm::builder::Sorts<lm::builder::SuffixOrder> sorts(reader.Order());
+ for (std::size_t i = 0; i < reader.Order(); ++i) {
+
+ // The following call to sorts.push_back() invokes the Sort constructor
+ // and appends the newly constructed Sort object to the sorts array.
+ //
+ // After the construction of the Sort object,
+ // two new threads will be running (each owned by the chains[i] object).
+ //
+ // The first new thread will execute BlockSorter.Run() to sort the n-gram entries of order (i+1)
+ // that were previously read into chains[i] by the ARPA input reader thread.
+ //
+ // The second new thread will execute WriteAndRecycle.Run()
+ // to write each sorted block of data to disk as a temporary file.
+ sorts.push_back(chains[i], sort_config, lm::builder::SuffixOrder(i + 1));
+
+ }
+
+ // Output to the same chains.
+ for (std::size_t i = 0; i < reader.Order(); ++i) {
+
+ // The following call to Chain::Wait()
+ // joins the threads owned by chains[i].
+ //
+ // As such the following call won't return
+ // until all threads owned by chains[i] have completed.
+ //
+ // The following call also resets chain[i]
+ // so that it can be reused
+ // (including free'ing the memory previously used by the chain)
+ chains[i].Wait();
+
+
+ // In an ideal world (without memory restrictions)
+ // we could merge all of the previously sorted blocks
+ // by reading them all completely into memory
+ // and then running merge sort over them.
+ //
+ // In the real world, we have memory restrictions;
+ // depending on how many blocks we have,
+ // and how much memory we can use to read from each block (sort_config.buffer_size)
+ // it may be the case that we have insufficient memory
+ // to read sort_config.buffer_size of data from each block from disk.
+ //
+ // If this occurs, then it will be necessary to perform one or more rounds of merge sort on disk;
+ // doing so will reduce the number of blocks that we will eventually need to read from
+ // when performing the final round of merge sort in memory.
+ //
+ // So, the following call determines whether it is necessary
+ // to perform one or more rounds of merge sort on disk;
+ // if such on-disk merge sorting is required, such sorting is performed.
+ //
+ // Finally, the following method launches a thread that calls OwningMergingReader.Run()
+ // to perform the final round of merge sort in memory.
+ //
+ // Merge sort could have be invoked directly
+ // so that merge sort memory doesn't coexist with Chain memory.
+ sorts[i].Output(chains[i]);
+ }
+
+ // sorts can go out of scope even though it's still writing to the chains.
+ // note that vocab going out of scope flushes to vocab_file.
+ }
+
+
+ // Get the vocabulary mapping used for this ARPA file
+ lm::builder::VocabReconstitute reconstitute(vocab_file.get());
+
+ // After the following call to the << method of chains,
+ // a new thread will be running
+ // and will be executing the Run() method of PrintARPA
+ // to print the final sorted ARPA file to standard output.
+ chains >> lm::builder::PrintARPA(reconstitute, counts, NULL, STDOUT_FILENO);
+
+ // Joins all threads that chains owns,
+ // and does a for loop over each chain object in chains,
+ // calling chain.Wait() on each such chain object
+ chains.Wait(true);
+
+}
diff --git a/klm/lm/left.hh b/klm/lm/left.hh
index 85c1ea37..36d61369 100644
--- a/klm/lm/left.hh
+++ b/klm/lm/left.hh
@@ -35,8 +35,8 @@
* phrase, even if hypotheses are generated left-to-right.
*/
-#ifndef LM_LEFT__
-#define LM_LEFT__
+#ifndef LM_LEFT_H
+#define LM_LEFT_H
#include "lm/max_order.hh"
#include "lm/state.hh"
@@ -213,4 +213,4 @@ template <class M> class RuleScore {
} // namespace ngram
} // namespace lm
-#endif // LM_LEFT__
+#endif // LM_LEFT_H
diff --git a/klm/lm/lm_exception.hh b/klm/lm/lm_exception.hh
index f607ced1..8bb61081 100644
--- a/klm/lm/lm_exception.hh
+++ b/klm/lm/lm_exception.hh
@@ -1,5 +1,5 @@
-#ifndef LM_LM_EXCEPTION__
-#define LM_LM_EXCEPTION__
+#ifndef LM_LM_EXCEPTION_H
+#define LM_LM_EXCEPTION_H
// Named to avoid conflict with util/exception.hh.
diff --git a/klm/lm/max_order.hh b/klm/lm/max_order.hh
index 3eb97ccd..f7344cde 100644
--- a/klm/lm/max_order.hh
+++ b/klm/lm/max_order.hh
@@ -1,9 +1,13 @@
-/* IF YOUR BUILD SYSTEM PASSES -DKENLM_MAX_ORDER, THEN CHANGE THE BUILD SYSTEM.
+#ifndef LM_MAX_ORDER_H
+#define LM_MAX_ORDER_H
+/* IF YOUR BUILD SYSTEM PASSES -DKENLM_MAX_ORDER_H, THEN CHANGE THE BUILD SYSTEM.
* If not, this is the default maximum order.
* Having this limit means that State can be
* (kMaxOrder - 1) * sizeof(float) bytes instead of
* sizeof(float*) + (kMaxOrder - 1) * sizeof(float) + malloc overhead
*/
#ifndef KENLM_ORDER_MESSAGE
-#define KENLM_ORDER_MESSAGE "If your build system supports changing KENLM_MAX_ORDER, change it there and recompile. In the KenLM tarball or Moses, use e.g. `bjam --max-kenlm-order=6 -a'. Otherwise, edit lm/max_order.hh."
+#define KENLM_ORDER_MESSAGE "If your build system supports changing KENLM_MAX_ORDER_H, change it there and recompile. In the KenLM tarball or Moses, use e.g. `bjam --max-kenlm-order=6 -a'. Otherwise, edit lm/max_order.hh."
#endif
+
+#endif // LM_MAX_ORDER_H
diff --git a/klm/lm/model.hh b/klm/lm/model.hh
index e75da93b..6925a56d 100644
--- a/klm/lm/model.hh
+++ b/klm/lm/model.hh
@@ -1,5 +1,5 @@
-#ifndef LM_MODEL__
-#define LM_MODEL__
+#ifndef LM_MODEL_H
+#define LM_MODEL_H
#include "lm/bhiksha.hh"
#include "lm/binary_format.hh"
@@ -153,4 +153,4 @@ base::Model *LoadVirtual(const char *file_name, const Config &config = Config(),
} // namespace ngram
} // namespace lm
-#endif // LM_MODEL__
+#endif // LM_MODEL_H
diff --git a/klm/lm/model_test.cc b/klm/lm/model_test.cc
index 7005b05e..0f54724b 100644
--- a/klm/lm/model_test.cc
+++ b/klm/lm/model_test.cc
@@ -176,7 +176,7 @@ template <class M> void MinimalState(const M &model) {
AppendTest("to", 1, -1.687872, false);
AppendTest("look", 2, -0.2922095, true);
BOOST_CHECK_EQUAL(2, state.length);
- AppendTest("good", 3, -7, true);
+ AppendTest("a", 3, -7, true);
}
template <class M> void ExtendLeftTest(const M &model) {
diff --git a/klm/lm/model_type.hh b/klm/lm/model_type.hh
index 8b35c793..fbe1117a 100644
--- a/klm/lm/model_type.hh
+++ b/klm/lm/model_type.hh
@@ -1,5 +1,5 @@
-#ifndef LM_MODEL_TYPE__
-#define LM_MODEL_TYPE__
+#ifndef LM_MODEL_TYPE_H
+#define LM_MODEL_TYPE_H
namespace lm {
namespace ngram {
@@ -20,4 +20,4 @@ const static ModelType kArrayAdd = static_cast<ModelType>(ARRAY_TRIE - TRIE);
} // namespace ngram
} // namespace lm
-#endif // LM_MODEL_TYPE__
+#endif // LM_MODEL_TYPE_H
diff --git a/klm/lm/neural/wordvecs.cc b/klm/lm/neural/wordvecs.cc
new file mode 100644
index 00000000..09bb4260
--- /dev/null
+++ b/klm/lm/neural/wordvecs.cc
@@ -0,0 +1,23 @@
+#include "lm/neural/wordvecs.hh"
+
+#include "util/file_piece.hh"
+
+namespace lm { namespace neural {
+
+WordVecs::WordVecs(util::FilePiece &f) {
+ const unsigned long lines = f.ReadULong();
+ const std::size_t vocab_mem = ngram::ProbingVocabulary::Size(lines, 1.5);
+ vocab_backing_.reset(util::CallocOrThrow(vocab_mem));
+ vocab_.SetupMemory(vocab_backing_.get(), vocab_mem);
+ const unsigned long width = f.ReadULong();
+ vecs_.resize(width, lines);
+ for (unsigned long i = 0; i < lines; ++i) {
+ WordIndex column = vocab_.Insert(f.ReadDelimited());
+ for (unsigned int row = 0; row < width; ++row) {
+ vecs_(row,column) = f.ReadFloat();
+ }
+ }
+ vocab_.FinishedLoading();
+}
+
+}} // namespaces
diff --git a/klm/lm/neural/wordvecs.hh b/klm/lm/neural/wordvecs.hh
new file mode 100644
index 00000000..921a2b22
--- /dev/null
+++ b/klm/lm/neural/wordvecs.hh
@@ -0,0 +1,38 @@
+#ifndef LM_NEURAL_WORDVECS_H
+#define LM_NEURAL_WORDVECS_H
+
+#include "util/scoped.hh"
+#include "lm/vocab.hh"
+
+#include <Eigen/Dense>
+
+namespace util { class FilePiece; }
+
+namespace lm {
+namespace neural {
+
+class WordVecs {
+ public:
+ // Columns of the matrix are word vectors. The column index is the word.
+ typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> Storage;
+
+ /* The file should begin with a line stating the number of word vectors and
+ * the length of the vectors. Then it's followed by lines containing a
+ * word followed by floating-point values.
+ */
+ explicit WordVecs(util::FilePiece &in);
+
+ const Storage &Vectors() const { return vecs_; }
+
+ WordIndex Index(StringPiece str) const { return vocab_.Index(str); }
+
+ private:
+ util::scoped_malloc vocab_backing_;
+ ngram::ProbingVocabulary vocab_;
+
+ Storage vecs_;
+};
+
+}} // namespaces
+
+#endif // LM_NEURAL_WORDVECS_H
diff --git a/klm/lm/ngram_query.hh b/klm/lm/ngram_query.hh
index ec2590f4..5f330c5c 100644
--- a/klm/lm/ngram_query.hh
+++ b/klm/lm/ngram_query.hh
@@ -1,8 +1,9 @@
-#ifndef LM_NGRAM_QUERY__
-#define LM_NGRAM_QUERY__
+#ifndef LM_NGRAM_QUERY_H
+#define LM_NGRAM_QUERY_H
#include "lm/enumerate_vocab.hh"
#include "lm/model.hh"
+#include "util/file_piece.hh"
#include "util/usage.hh"
#include <cstdlib>
@@ -16,64 +17,94 @@
namespace lm {
namespace ngram {
-template <class Model> void Query(const Model &model, bool sentence_context, std::istream &in_stream, std::ostream &out_stream) {
+struct BasicPrint {
+ void Word(StringPiece, WordIndex, const FullScoreReturn &) const {}
+ void Line(uint64_t oov, float total) const {
+ std::cout << "Total: " << total << " OOV: " << oov << '\n';
+ }
+ void Summary(double, double, uint64_t, uint64_t) {}
+
+};
+
+struct FullPrint : public BasicPrint {
+ void Word(StringPiece surface, WordIndex vocab, const FullScoreReturn &ret) const {
+ std::cout << surface << '=' << vocab << ' ' << static_cast<unsigned int>(ret.ngram_length) << ' ' << ret.prob << '\t';
+ }
+
+ void Summary(double ppl_including_oov, double ppl_excluding_oov, uint64_t corpus_oov, uint64_t corpus_tokens) {
+ std::cout <<
+ "Perplexity including OOVs:\t" << ppl_including_oov << "\n"
+ "Perplexity excluding OOVs:\t" << ppl_excluding_oov << "\n"
+ "OOVs:\t" << corpus_oov << "\n"
+ "Tokens:\t" << corpus_tokens << '\n'
+ ;
+ }
+};
+
+template <class Model, class Printer> void Query(const Model &model, bool sentence_context) {
+ Printer printer;
typename Model::State state, out;
lm::FullScoreReturn ret;
- std::string word;
+ StringPiece word;
+
+ util::FilePiece in(0);
double corpus_total = 0.0;
+ double corpus_total_oov_only = 0.0;
uint64_t corpus_oov = 0;
uint64_t corpus_tokens = 0;
- while (in_stream) {
+ while (true) {
state = sentence_context ? model.BeginSentenceState() : model.NullContextState();
float total = 0.0;
- bool got = false;
uint64_t oov = 0;
- while (in_stream >> word) {
- got = true;
+
+ while (in.ReadWordSameLine(word)) {
lm::WordIndex vocab = model.GetVocabulary().Index(word);
- if (vocab == 0) ++oov;
ret = model.FullScore(state, vocab, out);
+ if (vocab == model.GetVocabulary().NotFound()) {
+ ++oov;
+ corpus_total_oov_only += ret.prob;
+ }
total += ret.prob;
- out_stream << word << '=' << vocab << ' ' << static_cast<unsigned int>(ret.ngram_length) << ' ' << ret.prob << '\t';
+ printer.Word(word, vocab, ret);
++corpus_tokens;
state = out;
- char c;
- while (true) {
- c = in_stream.get();
- if (!in_stream) break;
- if (c == '\n') break;
- if (!isspace(c)) {
- in_stream.unget();
- break;
- }
- }
- if (c == '\n') break;
}
- if (!got && !in_stream) break;
+ // If people don't have a newline after their last query, this won't add a </s>.
+ // Sue me.
+ try {
+ UTIL_THROW_IF('\n' != in.get(), util::Exception, "FilePiece is confused.");
+ } catch (const util::EndOfFileException &e) { break; }
if (sentence_context) {
ret = model.FullScore(state, model.GetVocabulary().EndSentence(), out);
total += ret.prob;
++corpus_tokens;
- out_stream << "</s>=" << model.GetVocabulary().EndSentence() << ' ' << static_cast<unsigned int>(ret.ngram_length) << ' ' << ret.prob << '\t';
+ printer.Word("</s>", model.GetVocabulary().EndSentence(), ret);
}
- out_stream << "Total: " << total << " OOV: " << oov << '\n';
+ printer.Line(oov, total);
corpus_total += total;
corpus_oov += oov;
}
- out_stream << "Perplexity " << pow(10.0, -(corpus_total / static_cast<double>(corpus_tokens))) << std::endl;
+ printer.Summary(
+ pow(10.0, -(corpus_total / static_cast<double>(corpus_tokens))), // PPL including OOVs
+ pow(10.0, -((corpus_total - corpus_total_oov_only) / static_cast<double>(corpus_tokens - corpus_oov))), // PPL excluding OOVs
+ corpus_oov,
+ corpus_tokens);
}
-template <class M> void Query(const char *file, bool sentence_context, std::istream &in_stream, std::ostream &out_stream) {
- Config config;
- M model(file, config);
- Query(model, sentence_context, in_stream, out_stream);
+template <class Model> void Query(const char *file, const Config &config, bool sentence_context, bool show_words) {
+ Model model(file, config);
+ if (show_words) {
+ Query<Model, FullPrint>(model, sentence_context);
+ } else {
+ Query<Model, BasicPrint>(model, sentence_context);
+ }
}
} // namespace ngram
} // namespace lm
-#endif // LM_NGRAM_QUERY__
+#endif // LM_NGRAM_QUERY_H
diff --git a/klm/lm/partial.hh b/klm/lm/partial.hh
index 1dede359..d8adc696 100644
--- a/klm/lm/partial.hh
+++ b/klm/lm/partial.hh
@@ -1,5 +1,5 @@
-#ifndef LM_PARTIAL__
-#define LM_PARTIAL__
+#ifndef LM_PARTIAL_H
+#define LM_PARTIAL_H
#include "lm/return.hh"
#include "lm/state.hh"
@@ -164,4 +164,4 @@ template <class Model> float Subsume(const Model &model, Left &first_left, const
} // namespace ngram
} // namespace lm
-#endif // LM_PARTIAL__
+#endif // LM_PARTIAL_H
diff --git a/klm/lm/quantize.hh b/klm/lm/quantize.hh
index 9d3a2f43..84a30872 100644
--- a/klm/lm/quantize.hh
+++ b/klm/lm/quantize.hh
@@ -1,5 +1,5 @@
-#ifndef LM_QUANTIZE_H__
-#define LM_QUANTIZE_H__
+#ifndef LM_QUANTIZE_H
+#define LM_QUANTIZE_H
#include "lm/blank.hh"
#include "lm/config.hh"
@@ -230,4 +230,4 @@ class SeparatelyQuantize {
} // namespace ngram
} // namespace lm
-#endif // LM_QUANTIZE_H__
+#endif // LM_QUANTIZE_H
diff --git a/klm/lm/query_main.cc b/klm/lm/query_main.cc
index bd4fde62..3013ff21 100644
--- a/klm/lm/query_main.cc
+++ b/klm/lm/query_main.cc
@@ -1,4 +1,5 @@
#include "lm/ngram_query.hh"
+#include "util/getopt.hh"
#ifdef WITH_NPLM
#include "lm/wrappers/nplm.hh"
@@ -7,47 +8,76 @@
#include <stdlib.h>
void Usage(const char *name) {
- std::cerr << "KenLM was compiled with maximum order " << KENLM_MAX_ORDER << "." << std::endl;
- std::cerr << "Usage: " << name << " [-n] lm_file" << std::endl;
- std::cerr << "Input is wrapped in <s> and </s> unless -n is passed." << std::endl;
+ std::cerr <<
+ "KenLM was compiled with maximum order " << KENLM_MAX_ORDER << ".\n"
+ "Usage: " << name << " [-n] [-s] lm_file\n"
+ "-n: Do not wrap the input in <s> and </s>.\n"
+ "-s: Sentence totals only.\n"
+ "-l lazy|populate|read|parallel: Load lazily, with populate, or malloc+read\n"
+ "The default loading method is populate on Linux and read on others.\n";
exit(1);
}
int main(int argc, char *argv[]) {
+ if (argc == 1 || (argc == 2 && !strcmp(argv[1], "--help")))
+ Usage(argv[0]);
+
+ lm::ngram::Config config;
bool sentence_context = true;
- const char *file = NULL;
- for (char **arg = argv + 1; arg != argv + argc; ++arg) {
- if (!strcmp(*arg, "-n")) {
- sentence_context = false;
- } else if (!strcmp(*arg, "-h") || !strcmp(*arg, "--help") || file) {
- Usage(argv[0]);
- } else {
- file = *arg;
+ bool show_words = true;
+
+ int opt;
+ while ((opt = getopt(argc, argv, "hnsl:")) != -1) {
+ switch (opt) {
+ case 'n':
+ sentence_context = false;
+ break;
+ case 's':
+ show_words = false;
+ break;
+ case 'l':
+ if (!strcmp(optarg, "lazy")) {
+ config.load_method = util::LAZY;
+ } else if (!strcmp(optarg, "populate")) {
+ config.load_method = util::POPULATE_OR_READ;
+ } else if (!strcmp(optarg, "read")) {
+ config.load_method = util::READ;
+ } else if (!strcmp(optarg, "parallel")) {
+ config.load_method = util::PARALLEL_READ;
+ } else {
+ Usage(argv[0]);
+ }
+ break;
+ case 'h':
+ default:
+ Usage(argv[0]);
}
}
- if (!file) Usage(argv[0]);
+ if (optind + 1 != argc)
+ Usage(argv[0]);
+ const char *file = argv[optind];
try {
using namespace lm::ngram;
ModelType model_type;
if (RecognizeBinary(file, model_type)) {
switch(model_type) {
case PROBING:
- Query<lm::ngram::ProbingModel>(file, sentence_context, std::cin, std::cout);
+ Query<lm::ngram::ProbingModel>(file, config, sentence_context, show_words);
break;
case REST_PROBING:
- Query<lm::ngram::RestProbingModel>(file, sentence_context, std::cin, std::cout);
+ Query<lm::ngram::RestProbingModel>(file, config, sentence_context, show_words);
break;
case TRIE:
- Query<TrieModel>(file, sentence_context, std::cin, std::cout);
+ Query<TrieModel>(file, config, sentence_context, show_words);
break;
case QUANT_TRIE:
- Query<QuantTrieModel>(file, sentence_context, std::cin, std::cout);
+ Query<QuantTrieModel>(file, config, sentence_context, show_words);
break;
case ARRAY_TRIE:
- Query<ArrayTrieModel>(file, sentence_context, std::cin, std::cout);
+ Query<ArrayTrieModel>(file, config, sentence_context, show_words);
break;
case QUANT_ARRAY_TRIE:
- Query<QuantArrayTrieModel>(file, sentence_context, std::cin, std::cout);
+ Query<QuantArrayTrieModel>(file, config, sentence_context, show_words);
break;
default:
std::cerr << "Unrecognized kenlm model type " << model_type << std::endl;
@@ -56,12 +86,15 @@ int main(int argc, char *argv[]) {
#ifdef WITH_NPLM
} else if (lm::np::Model::Recognize(file)) {
lm::np::Model model(file);
- Query(model, sentence_context, std::cin, std::cout);
+ if (show_words) {
+ Query<lm::np::Model, lm::ngram::FullPrint>(model, sentence_context);
+ } else {
+ Query<lm::np::Model, lm::ngram::BasicPrint>(model, sentence_context);
+ }
#endif
} else {
- Query<ProbingModel>(file, sentence_context, std::cin, std::cout);
+ Query<ProbingModel>(file, config, sentence_context, show_words);
}
- std::cerr << "Total time including destruction:\n";
util::PrintUsage(std::cerr);
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
diff --git a/klm/lm/read_arpa.hh b/klm/lm/read_arpa.hh
index 234d130c..64eeef30 100644
--- a/klm/lm/read_arpa.hh
+++ b/klm/lm/read_arpa.hh
@@ -1,5 +1,5 @@
-#ifndef LM_READ_ARPA__
-#define LM_READ_ARPA__
+#ifndef LM_READ_ARPA_H
+#define LM_READ_ARPA_H
#include "lm/lm_exception.hh"
#include "lm/word_index.hh"
@@ -28,7 +28,7 @@ void ReadEnd(util::FilePiece &in);
extern const bool kARPASpaces[256];
-// Positive log probability warning.
+// Positive log probability warning.
class PositiveProbWarn {
public:
PositiveProbWarn() : action_(THROW_UP) {}
@@ -48,17 +48,17 @@ template <class Voc, class Weights> void Read1Gram(util::FilePiece &f, Voc &voca
warn.Warn(prob);
prob = 0.0;
}
- if (f.get() != '\t') UTIL_THROW(FormatLoadException, "Expected tab after probability");
- Weights &value = unigrams[vocab.Insert(f.ReadDelimited(kARPASpaces))];
- value.prob = prob;
- ReadBackoff(f, value);
+ UTIL_THROW_IF(f.get() != '\t', FormatLoadException, "Expected tab after probability");
+ WordIndex word = vocab.Insert(f.ReadDelimited(kARPASpaces));
+ Weights &w = unigrams[word];
+ w.prob = prob;
+ ReadBackoff(f, w);
} catch(util::Exception &e) {
e << " in the 1-gram at byte " << f.Offset();
throw;
}
}
-// Return true if a positive log probability came out.
template <class Voc, class Weights> void Read1Grams(util::FilePiece &f, std::size_t count, Voc &vocab, Weights *unigrams, PositiveProbWarn &warn) {
ReadNGramHeader(f, 1);
for (std::size_t i = 0; i < count; ++i) {
@@ -67,16 +67,21 @@ template <class Voc, class Weights> void Read1Grams(util::FilePiece &f, std::siz
vocab.FinishedLoading(unigrams);
}
-// Return true if a positive log probability came out.
-template <class Voc, class Weights> void ReadNGram(util::FilePiece &f, const unsigned char n, const Voc &vocab, WordIndex *const reverse_indices, Weights &weights, PositiveProbWarn &warn) {
+// Read ngram, write vocab ids to indices_out.
+template <class Voc, class Weights, class Iterator> void ReadNGram(util::FilePiece &f, const unsigned char n, const Voc &vocab, Iterator indices_out, Weights &weights, PositiveProbWarn &warn) {
try {
weights.prob = f.ReadFloat();
if (weights.prob > 0.0) {
warn.Warn(weights.prob);
weights.prob = 0.0;
}
- for (WordIndex *vocab_out = reverse_indices + n - 1; vocab_out >= reverse_indices; --vocab_out) {
- *vocab_out = vocab.Index(f.ReadDelimited(kARPASpaces));
+ for (unsigned char i = 0; i < n; ++i, ++indices_out) {
+ StringPiece word(f.ReadDelimited(kARPASpaces));
+ WordIndex index = vocab.Index(word);
+ *indices_out = index;
+ // Check for words mapped to <unk> that are not the string <unk>.
+ UTIL_THROW_IF(index == 0 /* mapped to <unk> */ && (word != StringPiece("<unk>", 5)) && (word != StringPiece("<UNK>", 5)),
+ FormatLoadException, "Word " << word << " was not seen in the unigrams (which are supposed to list the entire vocabulary) but appears");
}
ReadBackoff(f, weights);
} catch(util::Exception &e) {
@@ -87,4 +92,4 @@ template <class Voc, class Weights> void ReadNGram(util::FilePiece &f, const uns
} // namespace lm
-#endif // LM_READ_ARPA__
+#endif // LM_READ_ARPA_H
diff --git a/klm/lm/return.hh b/klm/lm/return.hh
index 622320ce..982ffd66 100644
--- a/klm/lm/return.hh
+++ b/klm/lm/return.hh
@@ -1,5 +1,5 @@
-#ifndef LM_RETURN__
-#define LM_RETURN__
+#ifndef LM_RETURN_H
+#define LM_RETURN_H
#include <stdint.h>
@@ -39,4 +39,4 @@ struct FullScoreReturn {
};
} // namespace lm
-#endif // LM_RETURN__
+#endif // LM_RETURN_H
diff --git a/klm/lm/search_hashed.cc b/klm/lm/search_hashed.cc
index 354a56b4..7e63e006 100644
--- a/klm/lm/search_hashed.cc
+++ b/klm/lm/search_hashed.cc
@@ -178,7 +178,7 @@ template <class Build, class Activate, class Store> void ReadNGrams(
typename Store::Entry entry;
std::vector<typename Value::Weights *> between;
for (size_t i = 0; i < count; ++i) {
- ReadNGram(f, n, vocab, &*vocab_ids.begin(), entry.value, warn);
+ ReadNGram(f, n, vocab, vocab_ids.rbegin(), entry.value, warn);
build.SetRest(&*vocab_ids.begin(), n, entry.value);
keys[0] = detail::CombineWordHash(static_cast<uint64_t>(vocab_ids.front()), vocab_ids[1]);
diff --git a/klm/lm/search_hashed.hh b/klm/lm/search_hashed.hh
index 8193262b..9dc84454 100644
--- a/klm/lm/search_hashed.hh
+++ b/klm/lm/search_hashed.hh
@@ -1,5 +1,5 @@
-#ifndef LM_SEARCH_HASHED__
-#define LM_SEARCH_HASHED__
+#ifndef LM_SEARCH_HASHED_H
+#define LM_SEARCH_HASHED_H
#include "lm/model_type.hh"
#include "lm/config.hh"
@@ -189,4 +189,4 @@ template <class Value> class HashedSearch {
} // namespace ngram
} // namespace lm
-#endif // LM_SEARCH_HASHED__
+#endif // LM_SEARCH_HASHED_H
diff --git a/klm/lm/search_trie.cc b/klm/lm/search_trie.cc
index 4a88194e..7fc70f4e 100644
--- a/klm/lm/search_trie.cc
+++ b/klm/lm/search_trie.cc
@@ -561,6 +561,7 @@ template <class Quant, class Bhiksha> uint8_t *TrieSearch<Quant, Bhiksha>::Setup
}
// Crazy backwards thing so we initialize using pointers to ones that have already been initialized
for (unsigned char i = counts.size() - 1; i >= 2; --i) {
+ // use "placement new" syntax to initalize Middle in an already-allocated memory location
new (middle_begin_ + i - 2) Middle(
middle_starts[i-2],
quant_.MiddleBits(config),
diff --git a/klm/lm/search_trie.hh b/klm/lm/search_trie.hh
index 299262a5..d8838d2b 100644
--- a/klm/lm/search_trie.hh
+++ b/klm/lm/search_trie.hh
@@ -1,5 +1,5 @@
-#ifndef LM_SEARCH_TRIE__
-#define LM_SEARCH_TRIE__
+#ifndef LM_SEARCH_TRIE_H
+#define LM_SEARCH_TRIE_H
#include "lm/config.hh"
#include "lm/model_type.hh"
@@ -127,4 +127,4 @@ template <class Quant, class Bhiksha> class TrieSearch {
} // namespace ngram
} // namespace lm
-#endif // LM_SEARCH_TRIE__
+#endif // LM_SEARCH_TRIE_H
diff --git a/klm/lm/sizes.hh b/klm/lm/sizes.hh
index 85abade7..eb7e99de 100644
--- a/klm/lm/sizes.hh
+++ b/klm/lm/sizes.hh
@@ -1,5 +1,5 @@
-#ifndef LM_SIZES__
-#define LM_SIZES__
+#ifndef LM_SIZES_H
+#define LM_SIZES_H
#include <vector>
@@ -14,4 +14,4 @@ void ShowSizes(const std::vector<uint64_t> &counts);
void ShowSizes(const char *file, const lm::ngram::Config &config);
}} // namespaces
-#endif // LM_SIZES__
+#endif // LM_SIZES_H
diff --git a/klm/lm/state.hh b/klm/lm/state.hh
index 543df37c..f6c51d6f 100644
--- a/klm/lm/state.hh
+++ b/klm/lm/state.hh
@@ -1,5 +1,5 @@
-#ifndef LM_STATE__
-#define LM_STATE__
+#ifndef LM_STATE_H
+#define LM_STATE_H
#include "lm/max_order.hh"
#include "lm/word_index.hh"
@@ -122,4 +122,4 @@ inline uint64_t hash_value(const ChartState &state) {
} // namespace ngram
} // namespace lm
-#endif // LM_STATE__
+#endif // LM_STATE_H
diff --git a/klm/lm/test.arpa b/klm/lm/test.arpa
index ef214eae..c4d2e6df 100644
--- a/klm/lm/test.arpa
+++ b/klm/lm/test.arpa
@@ -105,7 +105,7 @@ ngram 5=4
-0.04835128 looking on a -0.4771212
-3 also would consider -7
-6 <unk> however <unk> -12
--7 to look good
+-7 to look a
\4-grams:
-0.009249173 looking on a little -0.4771212
diff --git a/klm/lm/test_nounk.arpa b/klm/lm/test_nounk.arpa
index 060733d9..e38fc854 100644
--- a/klm/lm/test_nounk.arpa
+++ b/klm/lm/test_nounk.arpa
@@ -101,7 +101,7 @@ ngram 5=4
-0.1892331 little more loin
-0.04835128 looking on a -0.4771212
-3 also would consider -7
--7 to look good
+-7 to look a
\4-grams:
-0.009249173 looking on a little -0.4771212
diff --git a/klm/lm/trie.cc b/klm/lm/trie.cc
index d9895f89..5f8e7ce7 100644
--- a/klm/lm/trie.cc
+++ b/klm/lm/trie.cc
@@ -99,8 +99,11 @@ template <class Bhiksha> util::BitAddress BitPackedMiddle<Bhiksha>::Find(WordInd
}
template <class Bhiksha> void BitPackedMiddle<Bhiksha>::FinishedLoading(uint64_t next_end, const Config &config) {
- uint64_t last_next_write = (insert_index_ + 1) * total_bits_ - bhiksha_.InlineBits();
- bhiksha_.WriteNext(base_, last_next_write, insert_index_ + 1, next_end);
+ // Write at insert_index. . .
+ uint64_t last_next_write = insert_index_ * total_bits_ +
+ // at the offset where the next pointers are stored.
+ (total_bits_ - bhiksha_.InlineBits());
+ bhiksha_.WriteNext(base_, last_next_write, insert_index_, next_end);
bhiksha_.FinishedLoading(config);
}
diff --git a/klm/lm/trie.hh b/klm/lm/trie.hh
index d858ab5e..cd39298b 100644
--- a/klm/lm/trie.hh
+++ b/klm/lm/trie.hh
@@ -1,5 +1,5 @@
-#ifndef LM_TRIE__
-#define LM_TRIE__
+#ifndef LM_TRIE_H
+#define LM_TRIE_H
#include "lm/weights.hh"
#include "lm/word_index.hh"
@@ -143,4 +143,4 @@ class BitPackedLongest : public BitPacked {
} // namespace ngram
} // namespace lm
-#endif // LM_TRIE__
+#endif // LM_TRIE_H
diff --git a/klm/lm/trie_sort.cc b/klm/lm/trie_sort.cc
index 126d43ab..c3f46874 100644
--- a/klm/lm/trie_sort.cc
+++ b/klm/lm/trie_sort.cc
@@ -16,6 +16,7 @@
#include <cstdio>
#include <cstdlib>
#include <deque>
+#include <iterator>
#include <limits>
#include <vector>
@@ -106,14 +107,20 @@ FILE *WriteContextFile(uint8_t *begin, uint8_t *end, const std::string &temp_pre
}
struct ThrowCombine {
- void operator()(std::size_t /*entry_size*/, const void * /*first*/, const void * /*second*/, FILE * /*out*/) const {
- UTIL_THROW(FormatLoadException, "Duplicate n-gram detected.");
+ void operator()(std::size_t entry_size, unsigned char order, const void *first, const void *second, FILE * /*out*/) const {
+ const WordIndex *base = reinterpret_cast<const WordIndex*>(first);
+ FormatLoadException e;
+ e << "Duplicate n-gram detected with vocab ids";
+ for (const WordIndex *i = base; i != base + order; ++i) {
+ e << ' ' << *i;
+ }
+ throw e;
}
};
// Useful for context files that just contain records with no value.
struct FirstCombine {
- void operator()(std::size_t entry_size, const void *first, const void * /*second*/, FILE *out) const {
+ void operator()(std::size_t entry_size, unsigned char /*order*/, const void *first, const void * /*second*/, FILE *out) const {
util::WriteOrThrow(out, first, entry_size);
}
};
@@ -133,7 +140,7 @@ template <class Combine> FILE *MergeSortedFiles(FILE *first_file, FILE *second_f
util::WriteOrThrow(out_file.get(), second.Data(), entry_size);
++second;
} else {
- combine(entry_size, first.Data(), second.Data(), out_file.get());
+ combine(entry_size, order, first.Data(), second.Data(), out_file.get());
++first; ++second;
}
}
@@ -248,11 +255,13 @@ void SortedFiles::ConvertToSorted(util::FilePiece &f, const SortedVocabulary &vo
uint8_t *out_end = out + std::min(count - done, batch_size) * entry_size;
if (order == counts.size()) {
for (; out != out_end; out += entry_size) {
- ReadNGram(f, order, vocab, reinterpret_cast<WordIndex*>(out), *reinterpret_cast<Prob*>(out + words_size), warn);
+ std::reverse_iterator<WordIndex*> it(reinterpret_cast<WordIndex*>(out) + order);
+ ReadNGram(f, order, vocab, it, *reinterpret_cast<Prob*>(out + words_size), warn);
}
} else {
for (; out != out_end; out += entry_size) {
- ReadNGram(f, order, vocab, reinterpret_cast<WordIndex*>(out), *reinterpret_cast<ProbBackoff*>(out + words_size), warn);
+ std::reverse_iterator<WordIndex*> it(reinterpret_cast<WordIndex*>(out) + order);
+ ReadNGram(f, order, vocab, it, *reinterpret_cast<ProbBackoff*>(out + words_size), warn);
}
}
// Sort full records by full n-gram.
diff --git a/klm/lm/trie_sort.hh b/klm/lm/trie_sort.hh
index 1afd9562..e5406d9b 100644
--- a/klm/lm/trie_sort.hh
+++ b/klm/lm/trie_sort.hh
@@ -1,7 +1,7 @@
// Step of trie builder: create sorted files.
-#ifndef LM_TRIE_SORT__
-#define LM_TRIE_SORT__
+#ifndef LM_TRIE_SORT_H
+#define LM_TRIE_SORT_H
#include "lm/max_order.hh"
#include "lm/word_index.hh"
@@ -111,4 +111,4 @@ class SortedFiles {
} // namespace ngram
} // namespace lm
-#endif // LM_TRIE_SORT__
+#endif // LM_TRIE_SORT_H
diff --git a/klm/lm/value.hh b/klm/lm/value.hh
index ba716713..36e87084 100644
--- a/klm/lm/value.hh
+++ b/klm/lm/value.hh
@@ -1,5 +1,5 @@
-#ifndef LM_VALUE__
-#define LM_VALUE__
+#ifndef LM_VALUE_H
+#define LM_VALUE_H
#include "lm/model_type.hh"
#include "lm/value_build.hh"
@@ -154,4 +154,4 @@ struct RestValue {
} // namespace ngram
} // namespace lm
-#endif // LM_VALUE__
+#endif // LM_VALUE_H
diff --git a/klm/lm/value_build.hh b/klm/lm/value_build.hh
index 461e6a5c..6fd26ef8 100644
--- a/klm/lm/value_build.hh
+++ b/klm/lm/value_build.hh
@@ -1,5 +1,5 @@
-#ifndef LM_VALUE_BUILD__
-#define LM_VALUE_BUILD__
+#ifndef LM_VALUE_BUILD_H
+#define LM_VALUE_BUILD_H
#include "lm/weights.hh"
#include "lm/word_index.hh"
@@ -94,4 +94,4 @@ template <class Model> class LowerRestBuild {
} // namespace ngram
} // namespace lm
-#endif // LM_VALUE_BUILD__
+#endif // LM_VALUE_BUILD_H
diff --git a/klm/lm/virtual_interface.hh b/klm/lm/virtual_interface.hh
index 7a3e2379..2a2690e1 100644
--- a/klm/lm/virtual_interface.hh
+++ b/klm/lm/virtual_interface.hh
@@ -1,5 +1,5 @@
-#ifndef LM_VIRTUAL_INTERFACE__
-#define LM_VIRTUAL_INTERFACE__
+#ifndef LM_VIRTUAL_INTERFACE_H
+#define LM_VIRTUAL_INTERFACE_H
#include "lm/return.hh"
#include "lm/word_index.hh"
@@ -157,4 +157,4 @@ class Model {
} // mamespace base
} // namespace lm
-#endif // LM_VIRTUAL_INTERFACE__
+#endif // LM_VIRTUAL_INTERFACE_H
diff --git a/klm/lm/vocab.cc b/klm/lm/vocab.cc
index 7f0878f4..2285d279 100644
--- a/klm/lm/vocab.cc
+++ b/klm/lm/vocab.cc
@@ -170,11 +170,15 @@ struct ProbingVocabularyHeader {
ProbingVocabulary::ProbingVocabulary() : enumerate_(NULL) {}
+uint64_t ProbingVocabulary::Size(uint64_t entries, float probing_multiplier) {
+ return ALIGN8(sizeof(detail::ProbingVocabularyHeader)) + Lookup::Size(entries, probing_multiplier);
+}
+
uint64_t ProbingVocabulary::Size(uint64_t entries, const Config &config) {
- return ALIGN8(sizeof(detail::ProbingVocabularyHeader)) + Lookup::Size(entries, config.probing_multiplier);
+ return Size(entries, config.probing_multiplier);
}
-void ProbingVocabulary::SetupMemory(void *start, std::size_t allocated, std::size_t /*entries*/, const Config &/*config*/) {
+void ProbingVocabulary::SetupMemory(void *start, std::size_t allocated) {
header_ = static_cast<detail::ProbingVocabularyHeader*>(start);
lookup_ = Lookup(static_cast<uint8_t*>(start) + ALIGN8(sizeof(detail::ProbingVocabularyHeader)), allocated);
bound_ = 1;
@@ -201,12 +205,12 @@ WordIndex ProbingVocabulary::Insert(const StringPiece &str) {
return 0;
} else {
if (enumerate_) enumerate_->Add(bound_, str);
- lookup_.Insert(ProbingVocabuaryEntry::Make(hashed, bound_));
+ lookup_.Insert(ProbingVocabularyEntry::Make(hashed, bound_));
return bound_++;
}
}
-void ProbingVocabulary::InternalFinishedLoading() {
+void ProbingVocabulary::FinishedLoading() {
lookup_.FinishedInserting();
header_->bound = bound_;
header_->version = kProbingVocabularyVersion;
diff --git a/klm/lm/vocab.hh b/klm/lm/vocab.hh
index 074b74d8..d6ae07b8 100644
--- a/klm/lm/vocab.hh
+++ b/klm/lm/vocab.hh
@@ -1,9 +1,11 @@
-#ifndef LM_VOCAB__
-#define LM_VOCAB__
+#ifndef LM_VOCAB_H
+#define LM_VOCAB_H
#include "lm/enumerate_vocab.hh"
#include "lm/lm_exception.hh"
#include "lm/virtual_interface.hh"
+#include "util/fake_ofstream.hh"
+#include "util/murmur_hash.hh"
#include "util/pool.hh"
#include "util/probing_hash_table.hh"
#include "util/sorted_uniform.hh"
@@ -104,17 +106,16 @@ class SortedVocabulary : public base::Vocabulary {
#pragma pack(push)
#pragma pack(4)
-struct ProbingVocabuaryEntry {
+struct ProbingVocabularyEntry {
uint64_t key;
WordIndex value;
typedef uint64_t Key;
- uint64_t GetKey() const {
- return key;
- }
+ uint64_t GetKey() const { return key; }
+ void SetKey(uint64_t to) { key = to; }
- static ProbingVocabuaryEntry Make(uint64_t key, WordIndex value) {
- ProbingVocabuaryEntry ret;
+ static ProbingVocabularyEntry Make(uint64_t key, WordIndex value) {
+ ProbingVocabularyEntry ret;
ret.key = key;
ret.value = value;
return ret;
@@ -132,13 +133,18 @@ class ProbingVocabulary : public base::Vocabulary {
return lookup_.Find(detail::HashForVocab(str), i) ? i->value : 0;
}
+ static uint64_t Size(uint64_t entries, float probing_multiplier);
+ // This just unwraps Config to get the probing_multiplier.
static uint64_t Size(uint64_t entries, const Config &config);
// Vocab words are [0, Bound()).
WordIndex Bound() const { return bound_; }
// Everything else is for populating. I'm too lazy to hide and friend these, but you'll only get a const reference anyway.
- void SetupMemory(void *start, std::size_t allocated, std::size_t entries, const Config &config);
+ void SetupMemory(void *start, std::size_t allocated);
+ void SetupMemory(void *start, std::size_t allocated, std::size_t /*entries*/, const Config &/*config*/) {
+ SetupMemory(start, allocated);
+ }
void Relocate(void *new_start);
@@ -147,8 +153,9 @@ class ProbingVocabulary : public base::Vocabulary {
WordIndex Insert(const StringPiece &str);
template <class Weights> void FinishedLoading(Weights * /*reorder_vocab*/) {
- InternalFinishedLoading();
+ FinishedLoading();
}
+ void FinishedLoading();
std::size_t UnkCountChangePadding() const { return 0; }
@@ -157,9 +164,7 @@ class ProbingVocabulary : public base::Vocabulary {
void LoadedBinary(bool have_words, int fd, EnumerateVocab *to, uint64_t offset);
private:
- void InternalFinishedLoading();
-
- typedef util::ProbingHashTable<ProbingVocabuaryEntry, util::IdentityHash> Lookup;
+ typedef util::ProbingHashTable<ProbingVocabularyEntry, util::IdentityHash> Lookup;
Lookup lookup_;
@@ -181,7 +186,64 @@ template <class Vocab> void CheckSpecials(const Config &config, const Vocab &voc
if (vocab.EndSentence() == vocab.NotFound()) MissingSentenceMarker(config, "</s>");
}
+class WriteUniqueWords {
+ public:
+ explicit WriteUniqueWords(int fd) : word_list_(fd) {}
+
+ void operator()(const StringPiece &word) {
+ word_list_ << word << '\0';
+ }
+
+ private:
+ util::FakeOFStream word_list_;
+};
+
+class NoOpUniqueWords {
+ public:
+ NoOpUniqueWords() {}
+ void operator()(const StringPiece &word) {}
+};
+
+template <class NewWordAction = NoOpUniqueWords> class GrowableVocab {
+ public:
+ static std::size_t MemUsage(WordIndex content) {
+ return Lookup::MemUsage(content > 2 ? content : 2);
+ }
+
+ // Does not take ownership of write_wordi
+ template <class NewWordConstruct> GrowableVocab(WordIndex initial_size, const NewWordConstruct &new_word_construct = NewWordAction())
+ : lookup_(initial_size), new_word_(new_word_construct) {
+ FindOrInsert("<unk>"); // Force 0
+ FindOrInsert("<s>"); // Force 1
+ FindOrInsert("</s>"); // Force 2
+ }
+
+ WordIndex Index(const StringPiece &str) const {
+ Lookup::ConstIterator i;
+ return lookup_.Find(detail::HashForVocab(str), i) ? i->value : 0;
+ }
+
+ WordIndex FindOrInsert(const StringPiece &word) {
+ ProbingVocabularyEntry entry = ProbingVocabularyEntry::Make(util::MurmurHashNative(word.data(), word.size()), Size());
+ Lookup::MutableIterator it;
+ if (!lookup_.FindOrInsert(entry, it)) {
+ new_word_(word);
+ UTIL_THROW_IF(Size() >= std::numeric_limits<lm::WordIndex>::max(), VocabLoadException, "Too many vocabulary words. Change WordIndex to uint64_t in lm/word_index.hh");
+ }
+ return it->value;
+ }
+
+ WordIndex Size() const { return lookup_.Size(); }
+
+ private:
+ typedef util::AutoProbing<ProbingVocabularyEntry, util::IdentityHash> Lookup;
+
+ Lookup lookup_;
+
+ NewWordAction new_word_;
+};
+
} // namespace ngram
} // namespace lm
-#endif // LM_VOCAB__
+#endif // LM_VOCAB_H
diff --git a/klm/lm/weights.hh b/klm/lm/weights.hh
index bd5d8034..da1963d8 100644
--- a/klm/lm/weights.hh
+++ b/klm/lm/weights.hh
@@ -1,5 +1,5 @@
-#ifndef LM_WEIGHTS__
-#define LM_WEIGHTS__
+#ifndef LM_WEIGHTS_H
+#define LM_WEIGHTS_H
// Weights for n-grams. Probability and possibly a backoff.
@@ -19,4 +19,4 @@ struct RestWeights {
};
} // namespace lm
-#endif // LM_WEIGHTS__
+#endif // LM_WEIGHTS_H
diff --git a/klm/lm/word_index.hh b/klm/lm/word_index.hh
index e09557a7..a5a0fda8 100644
--- a/klm/lm/word_index.hh
+++ b/klm/lm/word_index.hh
@@ -1,6 +1,6 @@
// Separate header because this is used often.
-#ifndef LM_WORD_INDEX__
-#define LM_WORD_INDEX__
+#ifndef LM_WORD_INDEX_H
+#define LM_WORD_INDEX_H
#include <limits.h>
diff --git a/klm/lm/wrappers/README b/klm/lm/wrappers/README
new file mode 100644
index 00000000..56c34c23
--- /dev/null
+++ b/klm/lm/wrappers/README
@@ -0,0 +1,3 @@
+This directory is for wrappers around other people's LMs, presenting an interface similar to KenLM's. You will need to have their LM installed.
+
+NPLM is a work in progress.
diff --git a/klm/lm/wrappers/nplm.cc b/klm/lm/wrappers/nplm.cc
new file mode 100644
index 00000000..70622bd2
--- /dev/null
+++ b/klm/lm/wrappers/nplm.cc
@@ -0,0 +1,90 @@
+#include "lm/wrappers/nplm.hh"
+#include "util/exception.hh"
+#include "util/file.hh"
+
+#include <algorithm>
+
+#include <string.h>
+
+#include "neuralLM.h"
+
+namespace lm {
+namespace np {
+
+Vocabulary::Vocabulary(const nplm::vocabulary &vocab)
+ : base::Vocabulary(vocab.lookup_word("<s>"), vocab.lookup_word("</s>"), vocab.lookup_word("<unk>")),
+ vocab_(vocab), null_word_(vocab.lookup_word("<null>")) {}
+
+Vocabulary::~Vocabulary() {}
+
+WordIndex Vocabulary::Index(const std::string &str) const {
+ return vocab_.lookup_word(str);
+}
+
+bool Model::Recognize(const std::string &name) {
+ try {
+ util::scoped_fd file(util::OpenReadOrThrow(name.c_str()));
+ char magic_check[16];
+ util::ReadOrThrow(file.get(), magic_check, sizeof(magic_check));
+ const char nnlm_magic[] = "\\config\nversion ";
+ return !memcmp(magic_check, nnlm_magic, 16);
+ } catch (const util::Exception &) {
+ return false;
+ }
+}
+
+Model::Model(const std::string &file, std::size_t cache)
+ : base_instance_(new nplm::neuralLM(file)), vocab_(base_instance_->get_vocabulary()), cache_size_(cache) {
+ UTIL_THROW_IF(base_instance_->get_order() > NPLM_MAX_ORDER, util::Exception, "This NPLM has order " << (unsigned int)base_instance_->get_order() << " but the KenLM wrapper was compiled with " << NPLM_MAX_ORDER << ". Change the defintion of NPLM_MAX_ORDER and recompile.");
+ // log10 compatible with backoff models.
+ base_instance_->set_log_base(10.0);
+ State begin_sentence, null_context;
+ std::fill(begin_sentence.words, begin_sentence.words + NPLM_MAX_ORDER - 1, base_instance_->lookup_word("<s>"));
+ null_word_ = base_instance_->lookup_word("<null>");
+ std::fill(null_context.words, null_context.words + NPLM_MAX_ORDER - 1, null_word_);
+
+ Init(begin_sentence, null_context, vocab_, base_instance_->get_order());
+}
+
+Model::~Model() {}
+
+FullScoreReturn Model::FullScore(const State &from, const WordIndex new_word, State &out_state) const {
+ nplm::neuralLM *lm = backend_.get();
+ if (!lm) {
+ lm = new nplm::neuralLM(*base_instance_);
+ backend_.reset(lm);
+ lm->set_cache(cache_size_);
+ }
+ // State is in natural word order.
+ FullScoreReturn ret;
+ for (int i = 0; i < lm->get_order() - 1; ++i) {
+ lm->staging_ngram()(i) = from.words[i];
+ }
+ lm->staging_ngram()(lm->get_order() - 1) = new_word;
+ ret.prob = lm->lookup_from_staging();
+ // Always say full order.
+ ret.ngram_length = lm->get_order();
+ // Shift everything down by one.
+ memcpy(out_state.words, from.words + 1, sizeof(WordIndex) * (lm->get_order() - 2));
+ out_state.words[lm->get_order() - 2] = new_word;
+ // Fill in trailing words with zeros so state comparison works.
+ memset(out_state.words + lm->get_order() - 1, 0, sizeof(WordIndex) * (NPLM_MAX_ORDER - lm->get_order()));
+ return ret;
+}
+
+// TODO: optimize with direct call?
+FullScoreReturn Model::FullScoreForgotState(const WordIndex *context_rbegin, const WordIndex *context_rend, const WordIndex new_word, State &out_state) const {
+ // State is in natural word order. The API here specifies reverse order.
+ std::size_t state_length = std::min<std::size_t>(Order() - 1, context_rend - context_rbegin);
+ State state;
+ // Pad with null words.
+ for (lm::WordIndex *i = state.words; i < state.words + Order() - 1 - state_length; ++i) {
+ *i = null_word_;
+ }
+ // Put new words at the end.
+ std::reverse_copy(context_rbegin, context_rbegin + state_length, state.words + Order() - 1 - state_length);
+ return FullScore(state, new_word, out_state);
+}
+
+} // namespace np
+} // namespace lm
diff --git a/klm/lm/wrappers/nplm.hh b/klm/lm/wrappers/nplm.hh
new file mode 100644
index 00000000..b7dd4a21
--- /dev/null
+++ b/klm/lm/wrappers/nplm.hh
@@ -0,0 +1,83 @@
+#ifndef LM_WRAPPERS_NPLM_H
+#define LM_WRAPPERS_NPLM_H
+
+#include "lm/facade.hh"
+#include "lm/max_order.hh"
+#include "util/string_piece.hh"
+
+#include <boost/thread/tss.hpp>
+#include <boost/scoped_ptr.hpp>
+
+/* Wrapper to NPLM "by Ashish Vaswani, with contributions from David Chiang
+ * and Victoria Fossum."
+ * http://nlg.isi.edu/software/nplm/
+ */
+
+namespace nplm {
+class vocabulary;
+class neuralLM;
+} // namespace nplm
+
+namespace lm {
+namespace np {
+
+class Vocabulary : public base::Vocabulary {
+ public:
+ Vocabulary(const nplm::vocabulary &vocab);
+
+ ~Vocabulary();
+
+ WordIndex Index(const std::string &str) const;
+
+ // TODO: lobby them to support StringPiece
+ WordIndex Index(const StringPiece &str) const {
+ return Index(std::string(str.data(), str.size()));
+ }
+
+ lm::WordIndex NullWord() const { return null_word_; }
+
+ private:
+ const nplm::vocabulary &vocab_;
+
+ const lm::WordIndex null_word_;
+};
+
+// Sorry for imposing my limitations on your code.
+#define NPLM_MAX_ORDER 7
+
+struct State {
+ WordIndex words[NPLM_MAX_ORDER - 1];
+};
+
+class Model : public lm::base::ModelFacade<Model, State, Vocabulary> {
+ private:
+ typedef lm::base::ModelFacade<Model, State, Vocabulary> P;
+
+ public:
+ // Does this look like an NPLM?
+ static bool Recognize(const std::string &file);
+
+ explicit Model(const std::string &file, std::size_t cache_size = 1 << 20);
+
+ ~Model();
+
+ FullScoreReturn FullScore(const State &from, const WordIndex new_word, State &out_state) const;
+
+ FullScoreReturn FullScoreForgotState(const WordIndex *context_rbegin, const WordIndex *context_rend, const WordIndex new_word, State &out_state) const;
+
+ private:
+ boost::scoped_ptr<nplm::neuralLM> base_instance_;
+
+ mutable boost::thread_specific_ptr<nplm::neuralLM> backend_;
+
+ Vocabulary vocab_;
+
+ lm::WordIndex null_word_;
+
+ const std::size_t cache_size_;
+};
+
+} // namespace np
+} // namespace lm
+
+#endif // LM_WRAPPERS_NPLM_H
diff --git a/klm/util/Makefile.am b/klm/util/Makefile.am
index 5e650af7..5db6e340 100644
--- a/klm/util/Makefile.am
+++ b/klm/util/Makefile.am
@@ -1,21 +1,21 @@
-#noinst_PROGRAMS = \
+noinst_PROGRAMS = cat_compressed
+
+cat_compressed_SOURCES = cat_compressed_main.cc
+cat_compressed_LDADD = libklm_util.a
+
+#TESTS = \
# file_piece_test \
# joint_sort_test \
# key_value_packing_test \
# probing_hash_table_test \
# sorted_uniform_test
-
-#TESTS = \
# file_piece_test \
# joint_sort_test \
# key_value_packing_test \
# probing_hash_table_test \
# sorted_uniform_test
-#file_piece_test_SOURCES = file_piece_test.cc
-#file_piece_test_LDADD = libklm_util.a
-
noinst_LIBRARIES = libklm_util.a
libklm_util_a_SOURCES = \
@@ -30,6 +30,8 @@ libklm_util_a_SOURCES = \
file.hh \
file_piece.cc \
file_piece.hh \
+ fixed_array.hh \
+ getopt.c \
getopt.hh \
have.hh \
joint_sort.hh \
@@ -38,6 +40,8 @@ libklm_util_a_SOURCES = \
multi_intersection.hh \
murmur_hash.cc \
murmur_hash.hh \
+ parallel_read.cc \
+ parallel_read.hh \
pcqueue.hh \
pool.cc \
pool.hh \
@@ -54,7 +58,9 @@ libklm_util_a_SOURCES = \
string_piece_hash.hh \
thread_pool.hh \
tokenize_piece.hh \
+ unistd.hh \
usage.cc \
usage.hh
AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/klm -I$(top_srcdir)/klm/util/double-conversion
+
diff --git a/klm/util/bit_packing.hh b/klm/util/bit_packing.hh
index dcbd814c..1e34d9ab 100644
--- a/klm/util/bit_packing.hh
+++ b/klm/util/bit_packing.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_BIT_PACKING__
-#define UTIL_BIT_PACKING__
+#ifndef UTIL_BIT_PACKING_H
+#define UTIL_BIT_PACKING_H
/* Bit-level packing routines
*
@@ -183,4 +183,4 @@ struct BitAddress {
} // namespace util
-#endif // UTIL_BIT_PACKING__
+#endif // UTIL_BIT_PACKING_H
diff --git a/klm/util/cat_compressed_main.cc b/klm/util/cat_compressed_main.cc
new file mode 100644
index 00000000..2b4d7292
--- /dev/null
+++ b/klm/util/cat_compressed_main.cc
@@ -0,0 +1,47 @@
+// Like cat but interprets compressed files.
+#include "util/file.hh"
+#include "util/read_compressed.hh"
+
+#include <string.h>
+#include <iostream>
+
+namespace {
+const std::size_t kBufSize = 16384;
+void Copy(util::ReadCompressed &from, int to) {
+ util::scoped_malloc buffer(util::MallocOrThrow(kBufSize));
+ while (std::size_t amount = from.Read(buffer.get(), kBufSize)) {
+ util::WriteOrThrow(to, buffer.get(), amount);
+ }
+}
+} // namespace
+
+int main(int argc, char *argv[]) {
+ // Lane Schwartz likes -h and --help
+ for (int i = 1; i < argc; ++i) {
+ char *arg = argv[i];
+ if (!strcmp(arg, "--")) break;
+ if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) {
+ std::cerr <<
+ "A cat implementation that interprets compressed files.\n"
+ "Usage: " << argv[0] << " [file1] [file2] ...\n"
+ "If no file is provided, then stdin is read.\n";
+ return 1;
+ }
+ }
+
+ try {
+ if (argc == 1) {
+ util::ReadCompressed in(0);
+ Copy(in, 1);
+ } else {
+ for (int i = 1; i < argc; ++i) {
+ util::ReadCompressed in(util::OpenReadOrThrow(argv[i]));
+ Copy(in, 1);
+ }
+ }
+ } catch (const std::exception &e) {
+ std::cerr << e.what() << std::endl;
+ return 2;
+ }
+ return 0;
+}
diff --git a/klm/util/ersatz_progress.hh b/klm/util/ersatz_progress.hh
index b94399a8..535dbde2 100644
--- a/klm/util/ersatz_progress.hh
+++ b/klm/util/ersatz_progress.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_ERSATZ_PROGRESS__
-#define UTIL_ERSATZ_PROGRESS__
+#ifndef UTIL_ERSATZ_PROGRESS_H
+#define UTIL_ERSATZ_PROGRESS_H
#include <iostream>
#include <string>
@@ -55,4 +55,4 @@ class ErsatzProgress {
} // namespace util
-#endif // UTIL_ERSATZ_PROGRESS__
+#endif // UTIL_ERSATZ_PROGRESS_H
diff --git a/klm/util/exception.hh b/klm/util/exception.hh
index 0298272b..4e50a6f3 100644
--- a/klm/util/exception.hh
+++ b/klm/util/exception.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_EXCEPTION__
-#define UTIL_EXCEPTION__
+#ifndef UTIL_EXCEPTION_H
+#define UTIL_EXCEPTION_H
#include <exception>
#include <limits>
@@ -83,6 +83,9 @@ template <class Except, class Data> typename Except::template ExceptionTag<Excep
#define UTIL_THROW(Exception, Modify) \
UTIL_THROW_BACKEND(NULL, Exception, , Modify);
+#define UTIL_THROW2(Modify) \
+ UTIL_THROW_BACKEND(NULL, util::Exception, , Modify);
+
#if __GNUC__ >= 3
#define UTIL_UNLIKELY(x) __builtin_expect (!!(x), 0)
#else
@@ -143,4 +146,4 @@ inline std::size_t CheckOverflow(uint64_t value) {
} // namespace util
-#endif // UTIL_EXCEPTION__
+#endif // UTIL_EXCEPTION_H
diff --git a/klm/util/fake_ofstream.hh b/klm/util/fake_ofstream.hh
index bcdebe45..eefb1edc 100644
--- a/klm/util/fake_ofstream.hh
+++ b/klm/util/fake_ofstream.hh
@@ -2,6 +2,9 @@
* Does not support many data types. Currently, it's targeted at writing ARPA
* files quickly.
*/
+#ifndef UTIL_FAKE_OFSTREAM_H
+#define UTIL_FAKE_OFSTREAM_H
+
#include "util/double-conversion/double-conversion.h"
#include "util/double-conversion/utils.h"
#include "util/file.hh"
@@ -17,7 +20,8 @@ class FakeOFStream {
static const std::size_t kOutBuf = 1048576;
// Does not take ownership of out.
- explicit FakeOFStream(int out)
+ // Allows default constructor, but must call SetFD.
+ explicit FakeOFStream(int out = -1)
: buf_(util::MallocOrThrow(kOutBuf)),
builder_(static_cast<char*>(buf_.get()), kOutBuf),
// Mostly the default but with inf instead. And no flags.
@@ -28,6 +32,11 @@ class FakeOFStream {
if (buf_.get()) Flush();
}
+ void SetFD(int to) {
+ if (builder_.position()) Flush();
+ fd_ = to;
+ }
+
FakeOFStream &operator<<(float value) {
// Odd, but this is the largest number found in the comments.
EnsureRemaining(double_conversion::DoubleToStringConverter::kMaxPrecisionDigits + 8);
@@ -92,3 +101,5 @@ class FakeOFStream {
};
} // namespace
+
+#endif
diff --git a/klm/util/file.cc b/klm/util/file.cc
index 51eaf972..aa61cf9a 100644
--- a/klm/util/file.cc
+++ b/klm/util/file.cc
@@ -5,28 +5,29 @@
#include "util/exception.hh"
+#include <algorithm>
#include <cstdlib>
#include <cstdio>
-#include <sstream>
#include <iostream>
+#include <limits>
+#include <sstream>
+
#include <assert.h>
#include <errno.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
-#if defined __MINGW32__
+#if defined(__MINGW32__)
#include <windows.h>
#include <unistd.h>
#warning "The file functions on MinGW have not been tested for file sizes above 2^31 - 1. Please read https://stackoverflow.com/questions/12539488/determine-64-bit-file-size-in-c-on-mingw-32-bit and fix"
#elif defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <io.h>
-#include <algorithm>
-#include <limits.h>
-#include <limits>
#else
#include <unistd.h>
#endif
@@ -40,9 +41,9 @@ scoped_fd::~scoped_fd() {
}
}
-scoped_FILE::~scoped_FILE() {
- if (file_ && std::fclose(file_)) {
- std::cerr << "Could not close file " << std::endl;
+void scoped_FILE_closer::Close(std::FILE *file) {
+ if (file && std::fclose(file)) {
+ std::cerr << "Could not close file " << file << std::endl;
std::abort();
}
}
@@ -111,7 +112,7 @@ uint64_t SizeOrThrow(int fd) {
void ResizeOrThrow(int fd, uint64_t to) {
#if defined __MINGW32__
- // Does this handle 64-bit?
+ // Does this handle 64-bit?
int ret = ftruncate
#elif defined(_WIN32) || defined(_WIN64)
errno_t ret = _chsize_s
@@ -128,8 +129,10 @@ namespace {
std::size_t GuardLarge(std::size_t size) {
// The following operating systems have broken read/write/pread/pwrite that
// only supports up to 2^31.
+ // OS X man pages claim to support 64-bit, but Kareem M. Darwish had problems
+ // building with larger files, so APPLE is also here.
#if defined(_WIN32) || defined(_WIN64) || defined(__APPLE__) || defined(OS_ANDROID) || defined(__MINGW32__)
- return std::min(static_cast<std::size_t>(static_cast<unsigned>(-1)), size);
+ return size < INT_MAX ? size : INT_MAX;
#else
return size;
#endif
@@ -172,13 +175,44 @@ std::size_t ReadOrEOF(int fd, void *to_void, std::size_t amount) {
return amount;
}
-void PReadOrThrow(int fd, void *to_void, std::size_t size, uint64_t off) {
- uint8_t *to = static_cast<uint8_t*>(to_void);
+void WriteOrThrow(int fd, const void *data_void, std::size_t size) {
+ const uint8_t *data = static_cast<const uint8_t*>(data_void);
+ while (size) {
#if defined(_WIN32) || defined(_WIN64)
- UTIL_THROW(Exception, "This pread implementation for windows is broken. Please send me a patch that does not change the file pointer. Atomically. Or send me an implementation of pwrite that is allowed to change the file pointer but can be called concurrently with pread.");
- const std::size_t kMaxDWORD = static_cast<std::size_t>(4294967295UL);
+ int ret;
+#else
+ ssize_t ret;
#endif
- for (;size ;) {
+ errno = 0;
+ do {
+ ret =
+#if defined(_WIN32) || defined(_WIN64)
+ _write
+#else
+ write
+#endif
+ (fd, data, GuardLarge(size));
+ } while (ret == -1 && errno == EINTR);
+ UTIL_THROW_IF_ARG(ret < 1, FDException, (fd), "while writing " << size << " bytes");
+ data += ret;
+ size -= ret;
+ }
+}
+
+void WriteOrThrow(FILE *to, const void *data, std::size_t size) {
+ if (!size) return;
+ UTIL_THROW_IF(1 != std::fwrite(data, size, 1, to), ErrnoException, "Short write; requested size " << size);
+}
+
+#if defined(_WIN32) || defined(_WIN64)
+namespace {
+const std::size_t kMaxDWORD = static_cast<std::size_t>(4294967295UL);
+} // namespace
+#endif
+
+void ErsatzPRead(int fd, void *to_void, std::size_t size, uint64_t off) {
+ uint8_t *to = static_cast<uint8_t*>(to_void);
+ while (size) {
#if defined(_WIN32) || defined(_WIN64)
/* BROKEN: changes file pointer. Even if you save it and change it back, it won't be safe to use concurrently with write() or read() which lmplz does. */
// size_t might be 64-bit. DWORD is always 32.
@@ -192,16 +226,15 @@ void PReadOrThrow(int fd, void *to_void, std::size_t size, uint64_t off) {
#else
ssize_t ret;
errno = 0;
- do {
- ret =
+ ret =
#ifdef OS_ANDROID
- pread64
+ pread64
#else
- pread
+ pread
#endif
- (fd, to, GuardLarge(size), off);
- } while (ret == -1 && errno == EINTR);
+ (fd, to, GuardLarge(size), off);
if (ret <= 0) {
+ if (ret == -1 && errno == EINTR) continue;
UTIL_THROW_IF(ret == 0, EndOfFileException, " for reading " << size << " bytes at " << off << " from " << NameFromFD(fd));
UTIL_THROW_ARG(FDException, (fd), "while reading " << size << " bytes at offset " << off);
}
@@ -212,34 +245,41 @@ void PReadOrThrow(int fd, void *to_void, std::size_t size, uint64_t off) {
}
}
-void WriteOrThrow(int fd, const void *data_void, std::size_t size) {
- const uint8_t *data = static_cast<const uint8_t*>(data_void);
- while (size) {
+void ErsatzPWrite(int fd, const void *from_void, std::size_t size, uint64_t off) {
+ const uint8_t *from = static_cast<const uint8_t*>(from_void);
+ while(size) {
#if defined(_WIN32) || defined(_WIN64)
- int ret;
+ /* Changes file pointer. Even if you save it and change it back, it won't be safe to use concurrently with write() or read() */
+ // size_t might be 64-bit. DWORD is always 32.
+ DWORD writing = static_cast<DWORD>(std::min<std::size_t>(kMaxDWORD, size));
+ DWORD ret;
+ OVERLAPPED overlapped;
+ memset(&overlapped, 0, sizeof(OVERLAPPED));
+ overlapped.Offset = static_cast<DWORD>(off);
+ overlapped.OffsetHigh = static_cast<DWORD>(off >> 32);
+ UTIL_THROW_IF(!WriteFile((HANDLE)_get_osfhandle(fd), from, writing, &ret, &overlapped), Exception, "WriteFile failed for offset " << off);
#else
ssize_t ret;
-#endif
errno = 0;
- do {
- ret =
-#if defined(_WIN32) || defined(_WIN64)
- _write
+ ret =
+#ifdef OS_ANDROID
+ pwrite64
#else
- write
+ pwrite
+#endif
+ (fd, from, GuardLarge(size), off);
+ if (ret <= 0) {
+ if (ret == -1 && errno == EINTR) continue;
+ UTIL_THROW_IF(ret == 0, EndOfFileException, " for writing " << size << " bytes at " << off << " from " << NameFromFD(fd));
+ UTIL_THROW_ARG(FDException, (fd), "while writing " << size << " bytes at offset " << off);
+ }
#endif
- (fd, data, GuardLarge(size));
- } while (ret == -1 && errno == EINTR);
- UTIL_THROW_IF_ARG(ret < 1, FDException, (fd), "while writing " << size << " bytes");
- data += ret;
size -= ret;
+ off += ret;
+ from += ret;
}
}
-void WriteOrThrow(FILE *to, const void *data, std::size_t size) {
- if (!size) return;
- UTIL_THROW_IF(1 != std::fwrite(data, size, 1, to), ErrnoException, "Short write; requested size " << size);
-}
void FSyncOrThrow(int fd) {
// Apparently windows doesn't have fsync?
@@ -443,8 +483,8 @@ void NormalizeTempPrefix(std::string &base) {
) base += '/';
}
-int MakeTemp(const std::string &base) {
- std::string name(base);
+int MakeTemp(const StringPiece &base) {
+ std::string name(base.data(), base.size());
name += "XXXXXX";
name.push_back(0);
int ret;
@@ -452,7 +492,7 @@ int MakeTemp(const std::string &base) {
return ret;
}
-std::FILE *FMakeTemp(const std::string &base) {
+std::FILE *FMakeTemp(const StringPiece &base) {
util::scoped_fd file(MakeTemp(base));
return FDOpenOrThrow(file);
}
@@ -478,14 +518,18 @@ bool TryName(int fd, std::string &out) {
if (-1 == lstat(name.c_str(), &sb))
return false;
out.resize(sb.st_size + 1);
- ssize_t ret = readlink(name.c_str(), &out[0], sb.st_size + 1);
- if (-1 == ret)
- return false;
- if (ret > sb.st_size) {
- // Increased in size?!
- return false;
+ // lstat gave us a size, but I've seen it grow, possibly due to symlinks on top of symlinks.
+ while (true) {
+ ssize_t ret = readlink(name.c_str(), &out[0], out.size());
+ if (-1 == ret)
+ return false;
+ if ((size_t)ret < out.size()) {
+ out.resize(ret);
+ break;
+ }
+ // Exponential growth.
+ out.resize(out.size() * 2);
}
- out.resize(ret);
// Don't use the non-file names.
if (!out.empty() && out[0] != '/')
return false;
diff --git a/klm/util/file.hh b/klm/util/file.hh
index be88431d..7204b6a0 100644
--- a/klm/util/file.hh
+++ b/klm/util/file.hh
@@ -1,7 +1,9 @@
-#ifndef UTIL_FILE__
-#define UTIL_FILE__
+#ifndef UTIL_FILE_H
+#define UTIL_FILE_H
#include "util/exception.hh"
+#include "util/scoped.hh"
+#include "util/string_piece.hh"
#include <cstddef>
#include <cstdio>
@@ -41,29 +43,10 @@ class scoped_fd {
scoped_fd &operator=(const scoped_fd &);
};
-class scoped_FILE {
- public:
- explicit scoped_FILE(std::FILE *file = NULL) : file_(file) {}
-
- ~scoped_FILE();
-
- std::FILE *get() { return file_; }
- const std::FILE *get() const { return file_; }
-
- void reset(std::FILE *to = NULL) {
- scoped_FILE other(file_);
- file_ = to;
- }
-
- std::FILE *release() {
- std::FILE *ret = file_;
- file_ = NULL;
- return ret;
- }
-
- private:
- std::FILE *file_;
+struct scoped_FILE_closer {
+ static void Close(std::FILE *file);
};
+typedef scoped<std::FILE, scoped_FILE_closer> scoped_FILE;
/* Thrown for any operation where the fd is known. */
class FDException : public ErrnoException {
@@ -106,12 +89,20 @@ void ResizeOrThrow(int fd, uint64_t to);
std::size_t PartialRead(int fd, void *to, std::size_t size);
void ReadOrThrow(int fd, void *to, std::size_t size);
std::size_t ReadOrEOF(int fd, void *to_void, std::size_t size);
-// Positioned: unix only for now.
-void PReadOrThrow(int fd, void *to, std::size_t size, uint64_t off);
void WriteOrThrow(int fd, const void *data_void, std::size_t size);
void WriteOrThrow(FILE *to, const void *data, std::size_t size);
+/* These call pread/pwrite in a loop. However, on Windows they call ReadFile/
+ * WriteFile which changes the file pointer. So it's safe to call ErsatzPRead
+ * and ErsatzPWrite concurrently (or any combination thereof). But it changes
+ * the file pointer on windows, so it's not safe to call concurrently with
+ * anything that uses the implicit file pointer e.g. the Read/Write functions
+ * above.
+ */
+void ErsatzPRead(int fd, void *to, std::size_t size, uint64_t off);
+void ErsatzPWrite(int fd, const void *data_void, std::size_t size, uint64_t off);
+
void FSyncOrThrow(int fd);
// Seeking
@@ -125,8 +116,8 @@ std::FILE *FDOpenReadOrThrow(scoped_fd &file);
// Temporary files
// Append a / if base is a directory.
void NormalizeTempPrefix(std::string &base);
-int MakeTemp(const std::string &prefix);
-std::FILE *FMakeTemp(const std::string &prefix);
+int MakeTemp(const StringPiece &prefix);
+std::FILE *FMakeTemp(const StringPiece &prefix);
// dup an fd.
int DupOrThrow(int fd);
@@ -139,4 +130,4 @@ std::string NameFromFD(int fd);
} // namespace util
-#endif // UTIL_FILE__
+#endif // UTIL_FILE_H
diff --git a/klm/util/file_piece.cc b/klm/util/file_piece.cc
index 9c7e00c4..4aaa250e 100644
--- a/klm/util/file_piece.cc
+++ b/klm/util/file_piece.cc
@@ -84,6 +84,13 @@ StringPiece FilePiece::ReadLine(char delim) {
}
}
+bool FilePiece::ReadLineOrEOF(StringPiece &to, char delim) {
+ try {
+ to = ReadLine(delim);
+ } catch (const util::EndOfFileException &e) { return false; }
+ return true;
+}
+
float FilePiece::ReadFloat() {
return ReadNumber<float>();
}
diff --git a/klm/util/file_piece.hh b/klm/util/file_piece.hh
index ed3dc5ad..5495ddcc 100644
--- a/klm/util/file_piece.hh
+++ b/klm/util/file_piece.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_FILE_PIECE__
-#define UTIL_FILE_PIECE__
+#ifndef UTIL_FILE_PIECE_H
+#define UTIL_FILE_PIECE_H
#include "util/ersatz_progress.hh"
#include "util/exception.hh"
@@ -56,10 +56,33 @@ class FilePiece {
return Consume(FindDelimiterOrEOF(delim));
}
+ // Read word until the line or file ends.
+ bool ReadWordSameLine(StringPiece &to, const bool *delim = kSpaces) {
+ assert(delim[static_cast<unsigned char>('\n')]);
+ // Skip non-enter spaces.
+ for (; ; ++position_) {
+ if (position_ == position_end_) {
+ try {
+ Shift();
+ } catch (const util::EndOfFileException &e) { return false; }
+ // And break out at end of file.
+ if (position_ == position_end_) return false;
+ }
+ if (!delim[static_cast<unsigned char>(*position_)]) break;
+ if (*position_ == '\n') return false;
+ }
+ // We can't be at the end of file because there's at least one character open.
+ to = Consume(FindDelimiterOrEOF(delim));
+ return true;
+ }
+
// Unlike ReadDelimited, this includes leading spaces and consumes the delimiter.
// It is similar to getline in that way.
StringPiece ReadLine(char delim = '\n');
+ // Doesn't throw EndOfFileException, just returns false.
+ bool ReadLineOrEOF(StringPiece &to, char delim = '\n');
+
float ReadFloat();
double ReadDouble();
long int ReadLong();
@@ -132,4 +155,4 @@ class FilePiece {
} // namespace util
-#endif // UTIL_FILE_PIECE__
+#endif // UTIL_FILE_PIECE_H
diff --git a/klm/util/fixed_array.hh b/klm/util/fixed_array.hh
new file mode 100644
index 00000000..416b92f4
--- /dev/null
+++ b/klm/util/fixed_array.hh
@@ -0,0 +1,153 @@
+#ifndef UTIL_FIXED_ARRAY_H
+#define UTIL_FIXED_ARRAY_H
+
+#include "util/scoped.hh"
+
+#include <cstddef>
+
+#include <assert.h>
+#include <stdlib.h>
+
+namespace util {
+
+/**
+ * Defines a fixed-size collection.
+ *
+ * Ever want an array of things by they don't have a default constructor or are
+ * non-copyable? FixedArray allows constructing one at a time.
+ */
+template <class T> class FixedArray {
+ public:
+ /** Initialize with a given size bound but do not construct the objects. */
+ explicit FixedArray(std::size_t limit) {
+ Init(limit);
+ }
+
+ /**
+ * Constructs an instance, but does not initialize it.
+ *
+ * Any objects constructed in this manner must be subsequently @ref FixedArray::Init() "initialized" prior to use.
+ *
+ * @see FixedArray::Init()
+ */
+ FixedArray()
+ : newed_end_(NULL)
+#ifndef NDEBUG
+ , allocated_end_(NULL)
+#endif
+ {}
+
+ /**
+ * Initialize with a given size bound but do not construct the objects.
+ *
+ * This method is responsible for allocating memory.
+ * Objects stored in this array will be constructed in a location within this allocated memory.
+ */
+ void Init(std::size_t count) {
+ assert(!block_.get());
+ block_.reset(malloc(sizeof(T) * count));
+ if (!block_.get()) throw std::bad_alloc();
+ newed_end_ = begin();
+#ifndef NDEBUG
+ allocated_end_ = begin() + count;
+#endif
+ }
+
+ /**
+ * Constructs a copy of the provided array.
+ *
+ * @param from Array whose elements should be copied into this newly-constructed data structure.
+ */
+ FixedArray(const FixedArray &from) {
+ std::size_t size = from.newed_end_ - static_cast<const T*>(from.block_.get());
+ Init(size);
+ for (std::size_t i = 0; i < size; ++i) {
+ push_back(from[i]);
+ }
+ }
+
+ /**
+ * Frees the memory held by this object.
+ */
+ ~FixedArray() { clear(); }
+
+ /** Gets a pointer to the first object currently stored in this data structure. */
+ T *begin() { return static_cast<T*>(block_.get()); }
+
+ /** Gets a const pointer to the last object currently stored in this data structure. */
+ const T *begin() const { return static_cast<const T*>(block_.get()); }
+
+ /** Gets a pointer to the last object currently stored in this data structure. */
+ T *end() { return newed_end_; }
+
+ /** Gets a const pointer to the last object currently stored in this data structure. */
+ const T *end() const { return newed_end_; }
+
+ /** Gets a reference to the last object currently stored in this data structure. */
+ T &back() { return *(end() - 1); }
+
+ /** Gets a const reference to the last object currently stored in this data structure. */
+ const T &back() const { return *(end() - 1); }
+
+ /** Gets the number of objects currently stored in this data structure. */
+ std::size_t size() const { return end() - begin(); }
+
+ /** Returns true if there are no objects currently stored in this data structure. */
+ bool empty() const { return begin() == end(); }
+
+ /**
+ * Gets a reference to the object with index i currently stored in this data structure.
+ *
+ * @param i Index of the object to reference
+ */
+ T &operator[](std::size_t i) { return begin()[i]; }
+
+ /**
+ * Gets a const reference to the object with index i currently stored in this data structure.
+ *
+ * @param i Index of the object to reference
+ */
+ const T &operator[](std::size_t i) const { return begin()[i]; }
+
+ /**
+ * Constructs a new object using the provided parameter,
+ * and stores it in this data structure.
+ *
+ * The memory backing the constructed object is managed by this data structure.
+ */
+ template <class C> void push_back(const C &c) {
+ new (end()) T(c); // use "placement new" syntax to initalize T in an already-allocated memory location
+ Constructed();
+ }
+
+ /**
+ * Removes all elements from this array.
+ */
+ void clear() {
+ for (T *i = begin(); i != end(); ++i)
+ i->~T();
+ newed_end_ = begin();
+ }
+
+ protected:
+ // Always call Constructed after successful completion of new.
+ void Constructed() {
+ ++newed_end_;
+#ifndef NDEBUG
+ assert(newed_end_ <= allocated_end_);
+#endif
+ }
+
+ private:
+ util::scoped_malloc block_;
+
+ T *newed_end_;
+
+#ifndef NDEBUG
+ T *allocated_end_;
+#endif
+};
+
+} // namespace util
+
+#endif // UTIL_FIXED_ARRAY_H
diff --git a/klm/util/getopt.hh b/klm/util/getopt.hh
index 6ad97732..50eab56f 100644
--- a/klm/util/getopt.hh
+++ b/klm/util/getopt.hh
@@ -11,8 +11,8 @@ Code given out at the 1985 UNIFORUM conference in Dallas.
#endif
#ifndef __GNUC__
-#ifndef _WINGETOPT_H_
-#define _WINGETOPT_H_
+#ifndef UTIL_GETOPT_H
+#define UTIL_GETOPT_H
#ifdef __cplusplus
extern "C" {
@@ -28,6 +28,6 @@ extern int getopt(int argc, char **argv, char *opts);
}
#endif
-#endif /* _GETOPT_H_ */
+#endif /* UTIL_GETOPT_H */
#endif /* __GNUC__ */
diff --git a/klm/util/have.hh b/klm/util/have.hh
index 6e18529d..dc3f6330 100644
--- a/klm/util/have.hh
+++ b/klm/util/have.hh
@@ -1,6 +1,6 @@
/* Optional packages. You might want to integrate this with your build system e.g. config.h from ./configure. */
-#ifndef UTIL_HAVE__
-#define UTIL_HAVE__
+#ifndef UTIL_HAVE_H
+#define UTIL_HAVE_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -10,4 +10,4 @@
//#define HAVE_ICU
#endif
-#endif // UTIL_HAVE__
+#endif // UTIL_HAVE_H
diff --git a/klm/util/joint_sort.hh b/klm/util/joint_sort.hh
index b1ec48e2..de4b554f 100644
--- a/klm/util/joint_sort.hh
+++ b/klm/util/joint_sort.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_JOINT_SORT__
-#define UTIL_JOINT_SORT__
+#ifndef UTIL_JOINT_SORT_H
+#define UTIL_JOINT_SORT_H
/* A terrifying amount of C++ to coax std::sort into soring one range while
* also permuting another range the same way.
@@ -143,4 +143,4 @@ template <class KeyIter, class ValueIter> void JointSort(const KeyIter &key_begi
} // namespace util
-#endif // UTIL_JOINT_SORT__
+#endif // UTIL_JOINT_SORT_H
diff --git a/klm/util/mmap.cc b/klm/util/mmap.cc
index cee6a970..a3c8a022 100644
--- a/klm/util/mmap.cc
+++ b/klm/util/mmap.cc
@@ -6,6 +6,7 @@
#include "util/exception.hh"
#include "util/file.hh"
+#include "util/parallel_read.hh"
#include "util/scoped.hh"
#include <iostream>
@@ -40,7 +41,7 @@ void SyncOrThrow(void *start, size_t length) {
#if defined(_WIN32) || defined(_WIN64)
UTIL_THROW_IF(!::FlushViewOfFile(start, length), ErrnoException, "Failed to sync mmap");
#else
- UTIL_THROW_IF(msync(start, length, MS_SYNC), ErrnoException, "Failed to sync mmap");
+ UTIL_THROW_IF(length && msync(start, length, MS_SYNC), ErrnoException, "Failed to sync mmap");
#endif
}
@@ -154,6 +155,10 @@ void MapRead(LoadMethod method, int fd, uint64_t offset, std::size_t size, scope
SeekOrThrow(fd, offset);
ReadOrThrow(fd, out.get(), size);
break;
+ case PARALLEL_READ:
+ out.reset(MallocOrThrow(size), size, scoped_memory::MALLOC_ALLOCATED);
+ ParallelRead(fd, out.get(), size, offset);
+ break;
}
}
@@ -189,4 +194,66 @@ void *MapZeroedWrite(const char *name, std::size_t size, scoped_fd &file) {
}
}
+Rolling::Rolling(const Rolling &copy_from, uint64_t increase) {
+ *this = copy_from;
+ IncreaseBase(increase);
+}
+
+Rolling &Rolling::operator=(const Rolling &copy_from) {
+ fd_ = copy_from.fd_;
+ file_begin_ = copy_from.file_begin_;
+ file_end_ = copy_from.file_end_;
+ for_write_ = copy_from.for_write_;
+ block_ = copy_from.block_;
+ read_bound_ = copy_from.read_bound_;
+
+ current_begin_ = 0;
+ if (copy_from.IsPassthrough()) {
+ current_end_ = copy_from.current_end_;
+ ptr_ = copy_from.ptr_;
+ } else {
+ // Force call on next mmap.
+ current_end_ = 0;
+ ptr_ = NULL;
+ }
+ return *this;
+}
+
+Rolling::Rolling(int fd, bool for_write, std::size_t block, std::size_t read_bound, uint64_t offset, uint64_t amount) {
+ current_begin_ = 0;
+ current_end_ = 0;
+ fd_ = fd;
+ file_begin_ = offset;
+ file_end_ = offset + amount;
+ for_write_ = for_write;
+ block_ = block;
+ read_bound_ = read_bound;
+}
+
+void *Rolling::ExtractNonRolling(scoped_memory &out, uint64_t index, std::size_t size) {
+ out.reset();
+ if (IsPassthrough()) return static_cast<uint8_t*>(get()) + index;
+ uint64_t offset = index + file_begin_;
+ // Round down to multiple of page size.
+ uint64_t cruft = offset % static_cast<uint64_t>(SizePage());
+ std::size_t map_size = static_cast<std::size_t>(size + cruft);
+ out.reset(MapOrThrow(map_size, for_write_, kFileFlags, true, fd_, offset - cruft), map_size, scoped_memory::MMAP_ALLOCATED);
+ return static_cast<uint8_t*>(out.get()) + static_cast<std::size_t>(cruft);
+}
+
+void Rolling::Roll(uint64_t index) {
+ assert(!IsPassthrough());
+ std::size_t amount;
+ if (file_end_ - (index + file_begin_) > static_cast<uint64_t>(block_)) {
+ amount = block_;
+ current_end_ = index + amount - read_bound_;
+ } else {
+ amount = file_end_ - (index + file_begin_);
+ current_end_ = index + amount;
+ }
+ ptr_ = static_cast<uint8_t*>(ExtractNonRolling(mem_, index, amount)) - index;
+
+ current_begin_ = index;
+}
+
} // namespace util
diff --git a/klm/util/mmap.hh b/klm/util/mmap.hh
index b218c4d1..9b1e120f 100644
--- a/klm/util/mmap.hh
+++ b/klm/util/mmap.hh
@@ -1,8 +1,9 @@
-#ifndef UTIL_MMAP__
-#define UTIL_MMAP__
+#ifndef UTIL_MMAP_H
+#define UTIL_MMAP_H
// Utilities for mmaped files.
#include <cstddef>
+#include <limits>
#include <stdint.h>
#include <sys/types.h>
@@ -52,6 +53,9 @@ class scoped_memory {
public:
typedef enum {MMAP_ALLOCATED, ARRAY_ALLOCATED, MALLOC_ALLOCATED, NONE_ALLOCATED} Alloc;
+ scoped_memory(void *data, std::size_t size, Alloc source)
+ : data_(data), size_(size), source_(source) {}
+
scoped_memory() : data_(NULL), size_(0), source_(NONE_ALLOCATED) {}
~scoped_memory() { reset(); }
@@ -72,7 +76,6 @@ class scoped_memory {
void call_realloc(std::size_t to);
private:
-
void *data_;
std::size_t size_;
@@ -90,7 +93,9 @@ typedef enum {
// Populate on Linux. malloc and read on non-Linux.
POPULATE_OR_READ,
// malloc and read.
- READ
+ READ,
+ // malloc and read in parallel (recommended for Lustre)
+ PARALLEL_READ,
} LoadMethod;
extern const int kFileFlags;
@@ -109,6 +114,79 @@ void *MapZeroedWrite(const char *name, std::size_t size, scoped_fd &file);
// msync wrapper
void SyncOrThrow(void *start, size_t length);
+// Forward rolling memory map with no overlap.
+class Rolling {
+ public:
+ Rolling() {}
+
+ explicit Rolling(void *data) { Init(data); }
+
+ Rolling(const Rolling &copy_from, uint64_t increase = 0);
+ Rolling &operator=(const Rolling &copy_from);
+
+ // For an actual rolling mmap.
+ explicit Rolling(int fd, bool for_write, std::size_t block, std::size_t read_bound, uint64_t offset, uint64_t amount);
+
+ // For a static mapping
+ void Init(void *data) {
+ ptr_ = data;
+ current_end_ = std::numeric_limits<uint64_t>::max();
+ current_begin_ = 0;
+ // Mark as a pass-through.
+ fd_ = -1;
+ }
+
+ void IncreaseBase(uint64_t by) {
+ file_begin_ += by;
+ ptr_ = static_cast<uint8_t*>(ptr_) + by;
+ if (!IsPassthrough()) current_end_ = 0;
+ }
+
+ void DecreaseBase(uint64_t by) {
+ file_begin_ -= by;
+ ptr_ = static_cast<uint8_t*>(ptr_) - by;
+ if (!IsPassthrough()) current_end_ = 0;
+ }
+
+ void *ExtractNonRolling(scoped_memory &out, uint64_t index, std::size_t size);
+
+ // Returns base pointer
+ void *get() const { return ptr_; }
+
+ // Returns base pointer.
+ void *CheckedBase(uint64_t index) {
+ if (index >= current_end_ || index < current_begin_) {
+ Roll(index);
+ }
+ return ptr_;
+ }
+
+ // Returns indexed pointer.
+ void *CheckedIndex(uint64_t index) {
+ return static_cast<uint8_t*>(CheckedBase(index)) + index;
+ }
+
+ private:
+ void Roll(uint64_t index);
+
+ // True if this is just a thin wrapper on a pointer.
+ bool IsPassthrough() const { return fd_ == -1; }
+
+ void *ptr_;
+ uint64_t current_begin_;
+ uint64_t current_end_;
+
+ scoped_memory mem_;
+
+ int fd_;
+ uint64_t file_begin_;
+ uint64_t file_end_;
+
+ bool for_write_;
+ std::size_t block_;
+ std::size_t read_bound_;
+};
+
} // namespace util
-#endif // UTIL_MMAP__
+#endif // UTIL_MMAP_H
diff --git a/klm/util/multi_intersection.hh b/klm/util/multi_intersection.hh
index 04678352..2955acc7 100644
--- a/klm/util/multi_intersection.hh
+++ b/klm/util/multi_intersection.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_MULTI_INTERSECTION__
-#define UTIL_MULTI_INTERSECTION__
+#ifndef UTIL_MULTI_INTERSECTION_H
+#define UTIL_MULTI_INTERSECTION_H
#include <boost/optional.hpp>
#include <boost/range/iterator_range.hpp>
@@ -77,4 +77,4 @@ template <class Iterator, class Output> void AllIntersection(std::vector<boost::
} // namespace util
-#endif // UTIL_MULTI_INTERSECTION__
+#endif // UTIL_MULTI_INTERSECTION_H
diff --git a/klm/util/murmur_hash.hh b/klm/util/murmur_hash.hh
index 4891833e..f17157cd 100644
--- a/klm/util/murmur_hash.hh
+++ b/klm/util/murmur_hash.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_MURMUR_HASH__
-#define UTIL_MURMUR_HASH__
+#ifndef UTIL_MURMUR_HASH_H
+#define UTIL_MURMUR_HASH_H
#include <cstddef>
#include <stdint.h>
@@ -15,4 +15,4 @@ uint64_t MurmurHashNative(const void * key, std::size_t len, uint64_t seed = 0);
} // namespace util
-#endif // UTIL_MURMUR_HASH__
+#endif // UTIL_MURMUR_HASH_H
diff --git a/klm/util/parallel_read.cc b/klm/util/parallel_read.cc
new file mode 100644
index 00000000..6435eb84
--- /dev/null
+++ b/klm/util/parallel_read.cc
@@ -0,0 +1,69 @@
+#include "util/parallel_read.hh"
+
+#include "util/file.hh"
+
+#ifdef WITH_THREADS
+#include "util/thread_pool.hh"
+
+namespace util {
+namespace {
+
+class Reader {
+ public:
+ explicit Reader(int fd) : fd_(fd) {}
+
+ struct Request {
+ void *to;
+ std::size_t size;
+ uint64_t offset;
+
+ bool operator==(const Request &other) const {
+ return (to == other.to) && (size == other.size) && (offset == other.offset);
+ }
+ };
+
+ void operator()(const Request &request) {
+ util::ErsatzPRead(fd_, request.to, request.size, request.offset);
+ }
+
+ private:
+ int fd_;
+};
+
+} // namespace
+
+void ParallelRead(int fd, void *to, std::size_t amount, uint64_t offset) {
+ Reader::Request poison;
+ poison.to = NULL;
+ poison.size = 0;
+ poison.offset = 0;
+ unsigned threads = boost::thread::hardware_concurrency();
+ if (!threads) threads = 2;
+ ThreadPool<Reader> pool(2 /* don't need much of a queue */, threads, fd, poison);
+ const std::size_t kBatch = 1ULL << 25; // 32 MB
+ Reader::Request request;
+ request.to = to;
+ request.size = kBatch;
+ request.offset = offset;
+ for (; amount > kBatch; amount -= kBatch) {
+ pool.Produce(request);
+ request.to = reinterpret_cast<uint8_t*>(request.to) + kBatch;
+ request.offset += kBatch;
+ }
+ request.size = amount;
+ if (request.size) {
+ pool.Produce(request);
+ }
+}
+
+} // namespace util
+
+#else // WITH_THREADS
+
+namespace util {
+void ParallelRead(int fd, void *to, std::size_t amount, uint64_t offset) {
+ util::ErsatzPRead(fd, to, amount, offset);
+}
+} // namespace util
+
+#endif
diff --git a/klm/util/parallel_read.hh b/klm/util/parallel_read.hh
new file mode 100644
index 00000000..1e96e790
--- /dev/null
+++ b/klm/util/parallel_read.hh
@@ -0,0 +1,16 @@
+#ifndef UTIL_PARALLEL_READ__
+#define UTIL_PARALLEL_READ__
+
+/* Read pieces of a file in parallel. This has a very specific use case:
+ * reading files from Lustre is CPU bound so multiple threads actually
+ * increases throughput. Speed matters when an LM takes a terabyte.
+ */
+
+#include <cstddef>
+#include <stdint.h>
+
+namespace util {
+void ParallelRead(int fd, void *to, std::size_t amount, uint64_t offset);
+} // namespace util
+
+#endif // UTIL_PARALLEL_READ__
diff --git a/klm/util/pcqueue.hh b/klm/util/pcqueue.hh
index 07e4146f..d2ffee77 100644
--- a/klm/util/pcqueue.hh
+++ b/klm/util/pcqueue.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_PCQUEUE__
-#define UTIL_PCQUEUE__
+#ifndef UTIL_PCQUEUE_H
+#define UTIL_PCQUEUE_H
#include "util/exception.hh"
@@ -72,7 +72,8 @@ inline void WaitSemaphore (Semaphore &on) {
#endif // __APPLE__
-/* Producer consumer queue safe for multiple producers and multiple consumers.
+/**
+ * Producer consumer queue safe for multiple producers and multiple consumers.
* T must be default constructable and have operator=.
* The value is copied twice for Consume(T &out) or three times for Consume(),
* so larger objects should be passed via pointer.
@@ -152,4 +153,4 @@ template <class T> class PCQueue : boost::noncopyable {
} // namespace util
-#endif // UTIL_PCQUEUE__
+#endif // UTIL_PCQUEUE_H
diff --git a/klm/util/pool.hh b/klm/util/pool.hh
index 72f8a0c8..89e793d7 100644
--- a/klm/util/pool.hh
+++ b/klm/util/pool.hh
@@ -1,8 +1,8 @@
// Very simple pool. It can only allocate memory. And all of the memory it
// allocates must be freed at the same time.
-#ifndef UTIL_POOL__
-#define UTIL_POOL__
+#ifndef UTIL_POOL_H
+#define UTIL_POOL_H
#include <vector>
@@ -42,4 +42,4 @@ class Pool {
} // namespace util
-#endif // UTIL_POOL__
+#endif // UTIL_POOL_H
diff --git a/klm/util/probing_hash_table.hh b/klm/util/probing_hash_table.hh
index 38524806..ea228dd9 100644
--- a/klm/util/probing_hash_table.hh
+++ b/klm/util/probing_hash_table.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_PROBING_HASH_TABLE__
-#define UTIL_PROBING_HASH_TABLE__
+#ifndef UTIL_PROBING_HASH_TABLE_H
+#define UTIL_PROBING_HASH_TABLE_H
#include "util/exception.hh"
#include "util/scoped.hh"
@@ -258,6 +258,10 @@ template <class EntryT, class HashT, class EqualT = std::equal_to<typename Entry
private:
typedef ProbingHashTable<EntryT, HashT, EqualT> Backend;
public:
+ static std::size_t MemUsage(std::size_t size, float multiplier = 1.5) {
+ return Backend::Size(size, multiplier);
+ }
+
typedef EntryT Entry;
typedef typename Entry::Key Key;
typedef const Entry *ConstIterator;
@@ -268,6 +272,7 @@ template <class EntryT, class HashT, class EqualT = std::equal_to<typename Entry
AutoProbing(std::size_t initial_size = 10, const Key &invalid = Key(), const Hash &hash_func = Hash(), const Equal &equal_func = Equal()) :
allocated_(Backend::Size(initial_size, 1.5)), mem_(util::MallocOrThrow(allocated_)), backend_(mem_.get(), allocated_, invalid, hash_func, equal_func) {
threshold_ = initial_size * 1.2;
+ Clear();
}
// Assumes that the key is unique. Multiple insertions won't cause a failure, just inconsistent lookup.
@@ -323,4 +328,4 @@ template <class EntryT, class HashT, class EqualT = std::equal_to<typename Entry
} // namespace util
-#endif // UTIL_PROBING_HASH_TABLE__
+#endif // UTIL_PROBING_HASH_TABLE_H
diff --git a/klm/util/proxy_iterator.hh b/klm/util/proxy_iterator.hh
index a2810a47..8aa697bf 100644
--- a/klm/util/proxy_iterator.hh
+++ b/klm/util/proxy_iterator.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_PROXY_ITERATOR__
-#define UTIL_PROXY_ITERATOR__
+#ifndef UTIL_PROXY_ITERATOR_H
+#define UTIL_PROXY_ITERATOR_H
#include <cstddef>
#include <iterator>
@@ -98,4 +98,4 @@ template <class Proxy> ProxyIterator<Proxy> operator+(std::ptrdiff_t amount, con
} // namespace util
-#endif // UTIL_PROXY_ITERATOR__
+#endif // UTIL_PROXY_ITERATOR_H
diff --git a/klm/util/read_compressed.cc b/klm/util/read_compressed.cc
index b62a6e83..cee98040 100644
--- a/klm/util/read_compressed.cc
+++ b/klm/util/read_compressed.cc
@@ -49,6 +49,8 @@ class ReadBase {
thunk.internal_.reset(with);
}
+ ReadBase *Current(ReadCompressed &thunk) { return thunk.internal_.get(); }
+
static uint64_t &ReadCount(ReadCompressed &thunk) {
return thunk.raw_amount_;
}
@@ -56,6 +58,8 @@ class ReadBase {
namespace {
+ReadBase *ReadFactory(int fd, uint64_t &raw_amount, const void *already_data, std::size_t already_size, bool require_compressed);
+
// Completed file that other classes can thunk to.
class Complete : public ReadBase {
public:
@@ -80,7 +84,7 @@ class Uncompressed : public ReadBase {
class UncompressedWithHeader : public ReadBase {
public:
- UncompressedWithHeader(int fd, void *already_data, std::size_t already_size) : fd_(fd) {
+ UncompressedWithHeader(int fd, const void *already_data, std::size_t already_size) : fd_(fd) {
assert(already_size);
buf_.reset(malloc(already_size));
if (!buf_.get()) throw std::bad_alloc();
@@ -91,6 +95,7 @@ class UncompressedWithHeader : public ReadBase {
std::size_t Read(void *to, std::size_t amount, ReadCompressed &thunk) {
assert(buf_.get());
+ assert(remain_ != end_);
std::size_t sending = std::min<std::size_t>(amount, end_ - remain_);
memcpy(to, remain_, sending);
remain_ += sending;
@@ -108,23 +113,51 @@ class UncompressedWithHeader : public ReadBase {
scoped_fd fd_;
};
-#ifdef HAVE_ZLIB
-class GZip : public ReadBase {
+static const std::size_t kInputBuffer = 16384;
+
+template <class Compression> class StreamCompressed : public ReadBase {
+ public:
+ StreamCompressed(int fd, const void *already_data, std::size_t already_size)
+ : file_(fd),
+ in_buffer_(MallocOrThrow(kInputBuffer)),
+ back_(memcpy(in_buffer_.get(), already_data, already_size), already_size) {}
+
+ std::size_t Read(void *to, std::size_t amount, ReadCompressed &thunk) {
+ if (amount == 0) return 0;
+ back_.SetOutput(to, amount);
+ do {
+ if (!back_.Stream().avail_in) ReadInput(thunk);
+ if (!back_.Process()) {
+ // reached end, at least for the compressed portion.
+ std::size_t ret = static_cast<const uint8_t *>(static_cast<void*>(back_.Stream().next_out)) - static_cast<const uint8_t*>(to);
+ ReplaceThis(ReadFactory(file_.release(), ReadCount(thunk), back_.Stream().next_in, back_.Stream().avail_in, true), thunk);
+ if (ret) return ret;
+ // We did not read anything this round, so clients might think EOF. Transfer responsibility to the next reader.
+ return Current(thunk)->Read(to, amount, thunk);
+ }
+ } while (back_.Stream().next_out == to);
+ return static_cast<const uint8_t*>(static_cast<void*>(back_.Stream().next_out)) - static_cast<const uint8_t*>(to);
+ }
+
private:
- static const std::size_t kInputBuffer = 16384;
+ void ReadInput(ReadCompressed &thunk) {
+ assert(!back_.Stream().avail_in);
+ std::size_t got = ReadOrEOF(file_.get(), in_buffer_.get(), kInputBuffer);
+ back_.SetInput(in_buffer_.get(), got);
+ ReadCount(thunk) += got;
+ }
+
+ scoped_fd file_;
+ scoped_malloc in_buffer_;
+
+ Compression back_;
+};
+
+#ifdef HAVE_ZLIB
+class GZip {
public:
- GZip(int fd, void *already_data, std::size_t already_size)
- : file_(fd), in_buffer_(malloc(kInputBuffer)) {
- if (!in_buffer_.get()) throw std::bad_alloc();
- assert(already_size < kInputBuffer);
- if (already_size) {
- memcpy(in_buffer_.get(), already_data, already_size);
- stream_.next_in = static_cast<Bytef *>(in_buffer_.get());
- stream_.avail_in = already_size;
- stream_.avail_in += ReadOrEOF(file_.get(), static_cast<uint8_t*>(in_buffer_.get()) + already_size, kInputBuffer - already_size);
- } else {
- stream_.avail_in = 0;
- }
+ GZip(const void *base, std::size_t amount) {
+ SetInput(base, amount);
stream_.zalloc = Z_NULL;
stream_.zfree = Z_NULL;
stream_.opaque = Z_NULL;
@@ -141,227 +174,154 @@ class GZip : public ReadBase {
}
}
- std::size_t Read(void *to, std::size_t amount, ReadCompressed &thunk) {
- if (amount == 0) return 0;
+ void SetOutput(void *to, std::size_t amount) {
stream_.next_out = static_cast<Bytef*>(to);
stream_.avail_out = std::min<std::size_t>(std::numeric_limits<uInt>::max(), amount);
- do {
- if (!stream_.avail_in) ReadInput(thunk);
- int result = inflate(&stream_, 0);
- switch (result) {
- case Z_OK:
- break;
- case Z_STREAM_END:
- {
- std::size_t ret = static_cast<uint8_t*>(stream_.next_out) - static_cast<uint8_t*>(to);
- ReplaceThis(new Complete(), thunk);
- return ret;
- }
- case Z_ERRNO:
- UTIL_THROW(ErrnoException, "zlib error");
- default:
- UTIL_THROW(GZException, "zlib encountered " << (stream_.msg ? stream_.msg : "an error ") << " code " << result);
- }
- } while (stream_.next_out == to);
- return static_cast<uint8_t*>(stream_.next_out) - static_cast<uint8_t*>(to);
}
- private:
- void ReadInput(ReadCompressed &thunk) {
- assert(!stream_.avail_in);
- stream_.next_in = static_cast<Bytef *>(in_buffer_.get());
- stream_.avail_in = ReadOrEOF(file_.get(), in_buffer_.get(), kInputBuffer);
- ReadCount(thunk) += stream_.avail_in;
+ void SetInput(const void *base, std::size_t amount) {
+ assert(amount < static_cast<std::size_t>(std::numeric_limits<uInt>::max()));
+ stream_.next_in = const_cast<Bytef*>(static_cast<const Bytef*>(base));
+ stream_.avail_in = amount;
}
- scoped_fd file_;
- scoped_malloc in_buffer_;
+ const z_stream &Stream() const { return stream_; }
+
+ bool Process() {
+ int result = inflate(&stream_, 0);
+ switch (result) {
+ case Z_OK:
+ return true;
+ case Z_STREAM_END:
+ return false;
+ case Z_ERRNO:
+ UTIL_THROW(ErrnoException, "zlib error");
+ default:
+ UTIL_THROW(GZException, "zlib encountered " << (stream_.msg ? stream_.msg : "an error ") << " code " << result);
+ }
+ }
+
+ private:
z_stream stream_;
};
#endif // HAVE_ZLIB
-const uint8_t kBZMagic[3] = {'B', 'Z', 'h'};
-
#ifdef HAVE_BZLIB
-class BZip : public ReadBase {
+class BZip {
public:
- BZip(int fd, void *already_data, std::size_t already_size) {
- scoped_fd hold(fd);
- closer_.reset(FDOpenReadOrThrow(hold));
- file_ = NULL;
- Open(already_data, already_size);
+ BZip(const void *base, std::size_t amount) {
+ memset(&stream_, 0, sizeof(stream_));
+ SetInput(base, amount);
+ HandleError(BZ2_bzDecompressInit(&stream_, 0, 0));
}
- BZip(FILE *file, void *already_data, std::size_t already_size) {
- closer_.reset(file);
- file_ = NULL;
- Open(already_data, already_size);
+ ~BZip() {
+ try {
+ HandleError(BZ2_bzDecompressEnd(&stream_));
+ } catch (const std::exception &e) {
+ std::cerr << e.what() << std::endl;
+ abort();
+ }
}
- ~BZip() {
- Close(file_);
+ bool Process() {
+ int ret = BZ2_bzDecompress(&stream_);
+ if (ret == BZ_STREAM_END) return false;
+ HandleError(ret);
+ return true;
}
- std::size_t Read(void *to, std::size_t amount, ReadCompressed &thunk) {
- assert(file_);
- int bzerror = BZ_OK;
- int ret = BZ2_bzRead(&bzerror, file_, to, std::min<std::size_t>(static_cast<std::size_t>(INT_MAX), amount));
- long pos = ftell(closer_.get());
- if (pos != -1) ReadCount(thunk) = pos;
- switch (bzerror) {
- case BZ_STREAM_END:
- /* bzip2 files can be concatenated by e.g. pbzip2. Annoyingly, the
- * library doesn't handle this internally. This gets the trailing
- * data, grows it up to magic as needed, validates the magic, and
- * reopens.
- */
- {
- bzerror = BZ_OK;
- void *trailing_data;
- int trailing_size;
- BZ2_bzReadGetUnused(&bzerror, file_, &trailing_data, &trailing_size);
- UTIL_THROW_IF(bzerror != BZ_OK, BZException, "bzip2 error in BZ2_bzReadGetUnused " << BZ2_bzerror(file_, &bzerror) << " code " << bzerror);
- std::string trailing(static_cast<const char*>(trailing_data), trailing_size);
- Close(file_);
-
- if (trailing_size < (int)sizeof(kBZMagic)) {
- trailing.resize(sizeof(kBZMagic));
- if (1 != fread(&trailing[trailing_size], sizeof(kBZMagic) - trailing_size, 1, closer_.get())) {
- UTIL_THROW_IF(trailing_size, BZException, "File has trailing cruft");
- // Legitimate end of file.
- ReplaceThis(new Complete(), thunk);
- return ret;
- }
- }
- UTIL_THROW_IF(memcmp(trailing.data(), kBZMagic, sizeof(kBZMagic)), BZException, "Trailing cruft is not another bzip2 stream");
- Open(&trailing[0], trailing.size());
- }
- return ret;
- case BZ_OK:
- return ret;
- default:
- UTIL_THROW(BZException, "bzip2 error " << BZ2_bzerror(file_, &bzerror) << " code " << bzerror);
- }
+ void SetOutput(void *base, std::size_t amount) {
+ stream_.next_out = static_cast<char*>(base);
+ stream_.avail_out = std::min<std::size_t>(std::numeric_limits<unsigned int>::max(), amount);
}
+ void SetInput(const void *base, std::size_t amount) {
+ stream_.next_in = const_cast<char*>(static_cast<const char*>(base));
+ stream_.avail_in = amount;
+ }
+
+ const bz_stream &Stream() const { return stream_; }
+
private:
- void Open(void *already_data, std::size_t already_size) {
- assert(!file_);
- int bzerror = BZ_OK;
- file_ = BZ2_bzReadOpen(&bzerror, closer_.get(), 0, 0, already_data, already_size);
- switch (bzerror) {
+ void HandleError(int value) {
+ switch(value) {
case BZ_OK:
return;
case BZ_CONFIG_ERROR:
- UTIL_THROW(BZException, "Looks like bzip2 was miscompiled.");
+ UTIL_THROW(BZException, "bzip2 seems to be miscompiled.");
case BZ_PARAM_ERROR:
- UTIL_THROW(BZException, "Parameter error");
- case BZ_IO_ERROR:
- UTIL_THROW(BZException, "IO error reading file");
+ UTIL_THROW(BZException, "bzip2 Parameter error");
+ case BZ_DATA_ERROR:
+ UTIL_THROW(BZException, "bzip2 detected a corrupt file");
+ case BZ_DATA_ERROR_MAGIC:
+ UTIL_THROW(BZException, "bzip2 detected bad magic bytes. Perhaps this was not a bzip2 file after all?");
case BZ_MEM_ERROR:
throw std::bad_alloc();
default:
- UTIL_THROW(BZException, "Unknown bzip2 error code " << bzerror);
+ UTIL_THROW(BZException, "Unknown bzip2 error code " << value);
}
- assert(file_);
}
- static void Close(BZFILE *&file) {
- if (file == NULL) return;
- int bzerror = BZ_OK;
- BZ2_bzReadClose(&bzerror, file);
- if (bzerror != BZ_OK) {
- std::cerr << "bz2 readclose error number " << bzerror << std::endl;
- abort();
- }
- file = NULL;
- }
-
- scoped_FILE closer_;
- BZFILE *file_;
+ bz_stream stream_;
};
#endif // HAVE_BZLIB
#ifdef HAVE_XZLIB
-class XZip : public ReadBase {
- private:
- static const std::size_t kInputBuffer = 16384;
+class XZip {
public:
- XZip(int fd, void *already_data, std::size_t already_size)
- : file_(fd), in_buffer_(malloc(kInputBuffer)), stream_(), action_(LZMA_RUN) {
- if (!in_buffer_.get()) throw std::bad_alloc();
- assert(already_size < kInputBuffer);
- if (already_size) {
- memcpy(in_buffer_.get(), already_data, already_size);
- stream_.next_in = static_cast<const uint8_t*>(in_buffer_.get());
- stream_.avail_in = already_size;
- stream_.avail_in += ReadOrEOF(file_.get(), static_cast<uint8_t*>(in_buffer_.get()) + already_size, kInputBuffer - already_size);
- } else {
- stream_.avail_in = 0;
- }
- stream_.allocator = NULL;
- lzma_ret ret = lzma_stream_decoder(&stream_, UINT64_MAX, LZMA_CONCATENATED);
- switch (ret) {
- case LZMA_OK:
- break;
- case LZMA_MEM_ERROR:
- UTIL_THROW(ErrnoException, "xz open error");
- default:
- UTIL_THROW(XZException, "xz error code " << ret);
- }
+ XZip(const void *base, std::size_t amount)
+ : stream_(), action_(LZMA_RUN) {
+ memset(&stream_, 0, sizeof(stream_));
+ SetInput(base, amount);
+ HandleError(lzma_stream_decoder(&stream_, UINT64_MAX, 0));
}
~XZip() {
lzma_end(&stream_);
}
- std::size_t Read(void *to, std::size_t amount, ReadCompressed &thunk) {
- if (amount == 0) return 0;
- stream_.next_out = static_cast<uint8_t*>(to);
+ void SetOutput(void *base, std::size_t amount) {
+ stream_.next_out = static_cast<uint8_t*>(base);
stream_.avail_out = amount;
- do {
- if (!stream_.avail_in) ReadInput(thunk);
- lzma_ret status = lzma_code(&stream_, action_);
- switch (status) {
- case LZMA_OK:
- break;
- case LZMA_STREAM_END:
- UTIL_THROW_IF(action_ != LZMA_FINISH, XZException, "Input not finished yet.");
- {
- std::size_t ret = static_cast<uint8_t*>(stream_.next_out) - static_cast<uint8_t*>(to);
- ReplaceThis(new Complete(), thunk);
- return ret;
- }
- case LZMA_MEM_ERROR:
- throw std::bad_alloc();
- case LZMA_FORMAT_ERROR:
- UTIL_THROW(XZException, "xzlib says file format not recognized");
- case LZMA_OPTIONS_ERROR:
- UTIL_THROW(XZException, "xzlib says unsupported compression options");
- case LZMA_DATA_ERROR:
- UTIL_THROW(XZException, "xzlib says this file is corrupt");
- case LZMA_BUF_ERROR:
- UTIL_THROW(XZException, "xzlib says unexpected end of input");
- default:
- UTIL_THROW(XZException, "unrecognized xzlib error " << status);
- }
- } while (stream_.next_out == to);
- return static_cast<uint8_t*>(stream_.next_out) - static_cast<uint8_t*>(to);
+ }
+
+ void SetInput(const void *base, std::size_t amount) {
+ stream_.next_in = static_cast<const uint8_t*>(base);
+ stream_.avail_in = amount;
+ if (!amount) action_ = LZMA_FINISH;
+ }
+
+ const lzma_stream &Stream() const { return stream_; }
+
+ bool Process() {
+ lzma_ret status = lzma_code(&stream_, action_);
+ if (status == LZMA_STREAM_END) return false;
+ HandleError(status);
+ return true;
}
private:
- void ReadInput(ReadCompressed &thunk) {
- assert(!stream_.avail_in);
- stream_.next_in = static_cast<const uint8_t*>(in_buffer_.get());
- stream_.avail_in = ReadOrEOF(file_.get(), in_buffer_.get(), kInputBuffer);
- if (!stream_.avail_in) action_ = LZMA_FINISH;
- ReadCount(thunk) += stream_.avail_in;
+ void HandleError(lzma_ret value) {
+ switch (value) {
+ case LZMA_OK:
+ return;
+ case LZMA_MEM_ERROR:
+ throw std::bad_alloc();
+ case LZMA_FORMAT_ERROR:
+ UTIL_THROW(XZException, "xzlib says file format not recognized");
+ case LZMA_OPTIONS_ERROR:
+ UTIL_THROW(XZException, "xzlib says unsupported compression options");
+ case LZMA_DATA_ERROR:
+ UTIL_THROW(XZException, "xzlib says this file is corrupt");
+ case LZMA_BUF_ERROR:
+ UTIL_THROW(XZException, "xzlib says unexpected end of input");
+ default:
+ UTIL_THROW(XZException, "unrecognized xzlib error " << value);
+ }
}
- scoped_fd file_;
- scoped_malloc in_buffer_;
lzma_stream stream_;
-
lzma_action action_;
};
#endif // HAVE_XZLIB
@@ -384,66 +344,67 @@ class IStreamReader : public ReadBase {
};
enum MagicResult {
- UNKNOWN, GZIP, BZIP, XZIP
+ UTIL_UNKNOWN, UTIL_GZIP, UTIL_BZIP, UTIL_XZIP
};
-MagicResult DetectMagic(const void *from_void) {
+MagicResult DetectMagic(const void *from_void, std::size_t length) {
const uint8_t *header = static_cast<const uint8_t*>(from_void);
- if (header[0] == 0x1f && header[1] == 0x8b) {
- return GZIP;
+ if (length >= 2 && header[0] == 0x1f && header[1] == 0x8b) {
+ return UTIL_GZIP;
}
- if (!memcmp(header, kBZMagic, sizeof(kBZMagic))) {
- return BZIP;
+ const uint8_t kBZMagic[3] = {'B', 'Z', 'h'};
+ if (length >= sizeof(kBZMagic) && !memcmp(header, kBZMagic, sizeof(kBZMagic))) {
+ return UTIL_BZIP;
}
const uint8_t kXZMagic[6] = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
- if (!memcmp(header, kXZMagic, sizeof(kXZMagic))) {
- return XZIP;
+ if (length >= sizeof(kXZMagic) && !memcmp(header, kXZMagic, sizeof(kXZMagic))) {
+ return UTIL_XZIP;
}
- return UNKNOWN;
+ return UTIL_UNKNOWN;
}
-ReadBase *ReadFactory(int fd, uint64_t &raw_amount) {
+ReadBase *ReadFactory(int fd, uint64_t &raw_amount, const void *already_data, const std::size_t already_size, bool require_compressed) {
scoped_fd hold(fd);
- unsigned char header[ReadCompressed::kMagicSize];
- raw_amount = ReadOrEOF(fd, header, ReadCompressed::kMagicSize);
- if (!raw_amount)
- return new Uncompressed(hold.release());
- if (raw_amount != ReadCompressed::kMagicSize)
- return new UncompressedWithHeader(hold.release(), header, raw_amount);
- switch (DetectMagic(header)) {
- case GZIP:
+ std::string header(reinterpret_cast<const char*>(already_data), already_size);
+ if (header.size() < ReadCompressed::kMagicSize) {
+ std::size_t original = header.size();
+ header.resize(ReadCompressed::kMagicSize);
+ std::size_t got = ReadOrEOF(fd, &header[original], ReadCompressed::kMagicSize - original);
+ raw_amount += got;
+ header.resize(original + got);
+ }
+ if (header.empty()) {
+ return new Complete();
+ }
+ switch (DetectMagic(&header[0], header.size())) {
+ case UTIL_GZIP:
#ifdef HAVE_ZLIB
- return new GZip(hold.release(), header, ReadCompressed::kMagicSize);
+ return new StreamCompressed<GZip>(hold.release(), header.data(), header.size());
#else
UTIL_THROW(CompressedException, "This looks like a gzip file but gzip support was not compiled in.");
#endif
- case BZIP:
+ case UTIL_BZIP:
#ifdef HAVE_BZLIB
- return new BZip(hold.release(), header, ReadCompressed::kMagicSize);
+ return new StreamCompressed<BZip>(hold.release(), &header[0], header.size());
#else
- UTIL_THROW(CompressedException, "This looks like a bzip file (it begins with BZ), but bzip support was not compiled in.");
+ UTIL_THROW(CompressedException, "This looks like a bzip file (it begins with BZh), but bzip support was not compiled in.");
#endif
- case XZIP:
+ case UTIL_XZIP:
#ifdef HAVE_XZLIB
- return new XZip(hold.release(), header, ReadCompressed::kMagicSize);
+ return new StreamCompressed<XZip>(hold.release(), header.data(), header.size());
#else
UTIL_THROW(CompressedException, "This looks like an xz file, but xz support was not compiled in.");
#endif
- case UNKNOWN:
- break;
- }
- try {
- SeekOrThrow(fd, 0);
- } catch (const util::ErrnoException &e) {
- return new UncompressedWithHeader(hold.release(), header, ReadCompressed::kMagicSize);
+ default:
+ UTIL_THROW_IF(require_compressed, CompressedException, "Uncompressed data detected after a compresssed file. This could be supported but usually indicates an error.");
+ return new UncompressedWithHeader(hold.release(), header.data(), header.size());
}
- return new Uncompressed(hold.release());
}
} // namespace
bool ReadCompressed::DetectCompressedMagic(const void *from_void) {
- return DetectMagic(from_void) != UNKNOWN;
+ return DetectMagic(from_void, kMagicSize) != UTIL_UNKNOWN;
}
ReadCompressed::ReadCompressed(int fd) {
@@ -459,8 +420,9 @@ ReadCompressed::ReadCompressed() {}
ReadCompressed::~ReadCompressed() {}
void ReadCompressed::Reset(int fd) {
+ raw_amount_ = 0;
internal_.reset();
- internal_.reset(ReadFactory(fd, raw_amount_));
+ internal_.reset(ReadFactory(fd, raw_amount_, NULL, 0, false));
}
void ReadCompressed::Reset(std::istream &in) {
@@ -472,4 +434,15 @@ std::size_t ReadCompressed::Read(void *to, std::size_t amount) {
return internal_->Read(to, amount, *this);
}
+std::size_t ReadCompressed::ReadOrEOF(void *const to_in, std::size_t amount) {
+ uint8_t *to = reinterpret_cast<uint8_t*>(to_in);
+ while (amount) {
+ std::size_t got = Read(to, amount);
+ if (!got) break;
+ to += got;
+ amount -= got;
+ }
+ return to - reinterpret_cast<uint8_t*>(to_in);
+}
+
} // namespace util
diff --git a/klm/util/read_compressed.hh b/klm/util/read_compressed.hh
index 8b54c9e8..767ee94b 100644
--- a/klm/util/read_compressed.hh
+++ b/klm/util/read_compressed.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_READ_COMPRESSED__
-#define UTIL_READ_COMPRESSED__
+#ifndef UTIL_READ_COMPRESSED_H
+#define UTIL_READ_COMPRESSED_H
#include "util/exception.hh"
#include "util/scoped.hh"
@@ -62,6 +62,10 @@ class ReadCompressed {
std::size_t Read(void *to, std::size_t amount);
+ // Repeatedly call read to fill a buffer unless EOF is hit.
+ // Return number of bytes read.
+ std::size_t ReadOrEOF(void *const to, std::size_t amount);
+
uint64_t RawAmount() const { return raw_amount_; }
private:
@@ -78,4 +82,4 @@ class ReadCompressed {
} // namespace util
-#endif // UTIL_READ_COMPRESSED__
+#endif // UTIL_READ_COMPRESSED_H
diff --git a/klm/util/read_compressed_test.cc b/klm/util/read_compressed_test.cc
index 50450a02..301e8f4b 100644
--- a/klm/util/read_compressed_test.cc
+++ b/klm/util/read_compressed_test.cc
@@ -113,6 +113,11 @@ BOOST_AUTO_TEST_CASE(ReadXZ) {
}
#endif
+#ifdef HAVE_ZLIB
+BOOST_AUTO_TEST_CASE(AppendGZ) {
+}
+#endif
+
BOOST_AUTO_TEST_CASE(IStream) {
std::string name(WriteRandom());
std::fstream stream(name.c_str(), std::ios::in);
diff --git a/klm/util/scoped.cc b/klm/util/scoped.cc
index 6c5b0c2d..de1d9e94 100644
--- a/klm/util/scoped.cc
+++ b/klm/util/scoped.cc
@@ -32,10 +32,6 @@ void *CallocOrThrow(std::size_t requested) {
return InspectAddr(std::calloc(1, requested), requested, "calloc");
}
-scoped_malloc::~scoped_malloc() {
- std::free(p_);
-}
-
void scoped_malloc::call_realloc(std::size_t requested) {
p_ = InspectAddr(std::realloc(p_, requested), requested, "realloc");
}
diff --git a/klm/util/scoped.hh b/klm/util/scoped.hh
index b642d064..60c36c36 100644
--- a/klm/util/scoped.hh
+++ b/klm/util/scoped.hh
@@ -1,9 +1,10 @@
-#ifndef UTIL_SCOPED__
-#define UTIL_SCOPED__
+#ifndef UTIL_SCOPED_H
+#define UTIL_SCOPED_H
/* Other scoped objects in the style of scoped_ptr. */
#include "util/exception.hh"
#include <cstddef>
+#include <cstdlib>
namespace util {
@@ -16,89 +17,93 @@ class MallocException : public ErrnoException {
void *MallocOrThrow(std::size_t requested);
void *CallocOrThrow(std::size_t requested);
-class scoped_malloc {
+/* Unfortunately, defining the operator* for void * makes the compiler complain.
+ * So scoped is specialized to void. This includes the functionality common to
+ * both, namely everything except reference.
+ */
+template <class T, class Closer> class scoped_base {
public:
- scoped_malloc() : p_(NULL) {}
+ explicit scoped_base(T *p = NULL) : p_(p) {}
- scoped_malloc(void *p) : p_(p) {}
+ ~scoped_base() { Closer::Close(p_); }
- ~scoped_malloc();
-
- void reset(void *p = NULL) {
- scoped_malloc other(p_);
+ void reset(T *p = NULL) {
+ scoped_base other(p_);
p_ = p;
}
- void call_realloc(std::size_t to);
-
- void *get() { return p_; }
- const void *get() const { return p_; }
-
- private:
- void *p_;
-
- scoped_malloc(const scoped_malloc &);
- scoped_malloc &operator=(const scoped_malloc &);
-};
-
-// Hat tip to boost.
-template <class T> class scoped_array {
- public:
- explicit scoped_array(T *content = NULL) : c_(content) {}
-
- ~scoped_array() { delete [] c_; }
-
- T *get() { return c_; }
- const T* get() const { return c_; }
+ T *get() { return p_; }
+ const T *get() const { return p_; }
- T &operator*() { return *c_; }
- const T&operator*() const { return *c_; }
+ T *operator->() { return p_; }
+ const T *operator->() const { return p_; }
- T &operator[](std::size_t idx) { return c_[idx]; }
- const T &operator[](std::size_t idx) const { return c_[idx]; }
-
- void reset(T *to = NULL) {
- scoped_array<T> other(c_);
- c_ = to;
+ T *release() {
+ T *ret = p_;
+ p_ = NULL;
+ return ret;
}
- private:
- T *c_;
+ protected:
+ T *p_;
- scoped_array(const scoped_array &);
- void operator=(const scoped_array &);
+ private:
+ scoped_base(const scoped_base &);
+ scoped_base &operator=(const scoped_base &);
};
-template <class T> class scoped_ptr {
+template <class T, class Closer> class scoped : public scoped_base<T, Closer> {
public:
- explicit scoped_ptr(T *content = NULL) : c_(content) {}
+ explicit scoped(T *p = NULL) : scoped_base<T, Closer>(p) {}
- ~scoped_ptr() { delete c_; }
+ T &operator*() { return *scoped_base<T, Closer>::p_; }
+ const T&operator*() const { return *scoped_base<T, Closer>::p_; }
+};
- T *get() { return c_; }
- const T* get() const { return c_; }
+template <class Closer> class scoped<void, Closer> : public scoped_base<void, Closer> {
+ public:
+ explicit scoped(void *p = NULL) : scoped_base<void, Closer>(p) {}
+};
- T &operator*() { return *c_; }
- const T&operator*() const { return *c_; }
+/* Closer for c functions like std::free and cmph cleanup functions */
+template <class T, void (*clean)(T*)> struct scoped_c_forward {
+ static void Close(T *p) { clean(p); }
+};
+// Call a C function to delete stuff
+template <class T, void (*clean)(T*)> class scoped_c : public scoped<T, scoped_c_forward<T, clean> > {
+ public:
+ explicit scoped_c(T *p = NULL) : scoped<T, scoped_c_forward<T, clean> >(p) {}
+};
- T *operator->() { return c_; }
- const T*operator->() const { return c_; }
+class scoped_malloc : public scoped_c<void, std::free> {
+ public:
+ explicit scoped_malloc(void *p = NULL) : scoped_c<void, std::free>(p) {}
- T &operator[](std::size_t idx) { return c_[idx]; }
- const T &operator[](std::size_t idx) const { return c_[idx]; }
+ void call_realloc(std::size_t to);
+};
- void reset(T *to = NULL) {
- scoped_ptr<T> other(c_);
- c_ = to;
- }
+/* scoped_array using delete[] */
+struct scoped_delete_array_forward {
+ template <class T> static void Close(T *p) { delete [] p; }
+};
+// Hat tip to boost.
+template <class T> class scoped_array : public scoped<T, scoped_delete_array_forward> {
+ public:
+ explicit scoped_array(T *p = NULL) : scoped<T, scoped_delete_array_forward>(p) {}
- private:
- T *c_;
+ T &operator[](std::size_t idx) { return scoped<T, scoped_delete_array_forward>::p_[idx]; }
+ const T &operator[](std::size_t idx) const { return scoped<T, scoped_delete_array_forward>::p_[idx]; }
+};
- scoped_ptr(const scoped_ptr &);
- void operator=(const scoped_ptr &);
+/* scoped_ptr using delete. If only there were a template typedef. */
+struct scoped_delete_forward {
+ template <class T> static void Close(T *p) { delete p; }
+};
+template <class T> class scoped_ptr : public scoped<T, scoped_delete_forward> {
+ public:
+ explicit scoped_ptr(T *p = NULL) : scoped<T, scoped_delete_forward>(p) {}
};
} // namespace util
-#endif // UTIL_SCOPED__
+#endif // UTIL_SCOPED_H
diff --git a/klm/util/sized_iterator.hh b/klm/util/sized_iterator.hh
index a72657b5..75f6886f 100644
--- a/klm/util/sized_iterator.hh
+++ b/klm/util/sized_iterator.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_SIZED_ITERATOR__
-#define UTIL_SIZED_ITERATOR__
+#ifndef UTIL_SIZED_ITERATOR_H
+#define UTIL_SIZED_ITERATOR_H
#include "util/proxy_iterator.hh"
@@ -117,4 +117,4 @@ template <class Delegate, class Proxy = SizedProxy> class SizedCompare : public
};
} // namespace util
-#endif // UTIL_SIZED_ITERATOR__
+#endif // UTIL_SIZED_ITERATOR_H
diff --git a/klm/util/sorted_uniform.hh b/klm/util/sorted_uniform.hh
index 7700d9e6..a3f6d021 100644
--- a/klm/util/sorted_uniform.hh
+++ b/klm/util/sorted_uniform.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_SORTED_UNIFORM__
-#define UTIL_SORTED_UNIFORM__
+#ifndef UTIL_SORTED_UNIFORM_H
+#define UTIL_SORTED_UNIFORM_H
#include <algorithm>
#include <cstddef>
@@ -101,27 +101,6 @@ template <class Iterator, class Accessor, class Pivot> bool SortedUniformFind(co
return BoundedSortedUniformFind<Iterator, Accessor, Pivot>(accessor, begin, below, end, above, key, out);
}
-// May return begin - 1.
-template <class Iterator, class Accessor> Iterator BinaryBelow(
- const Accessor &accessor,
- Iterator begin,
- Iterator end,
- const typename Accessor::Key key) {
- while (end > begin) {
- Iterator pivot(begin + (end - begin) / 2);
- typename Accessor::Key mid(accessor(pivot));
- if (mid < key) {
- begin = pivot + 1;
- } else if (mid > key) {
- end = pivot;
- } else {
- for (++pivot; (pivot < end) && accessor(pivot) == mid; ++pivot) {}
- return pivot - 1;
- }
- }
- return begin - 1;
-}
-
} // namespace util
-#endif // UTIL_SORTED_UNIFORM__
+#endif // UTIL_SORTED_UNIFORM_H
diff --git a/klm/util/stream/Makefile.am b/klm/util/stream/Makefile.am
index f18cbedb..25817b50 100644
--- a/klm/util/stream/Makefile.am
+++ b/klm/util/stream/Makefile.am
@@ -11,6 +11,7 @@ libklm_util_stream_a_SOURCES = \
line_input.hh \
multi_progress.cc \
multi_progress.hh \
+ multi_stream.hh \
sort.hh \
stream.hh \
timer.hh
diff --git a/klm/util/stream/block.hh b/klm/util/stream/block.hh
index 11aa991e..aa7e28bb 100644
--- a/klm/util/stream/block.hh
+++ b/klm/util/stream/block.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_BLOCK__
-#define UTIL_STREAM_BLOCK__
+#ifndef UTIL_STREAM_BLOCK_H
+#define UTIL_STREAM_BLOCK_H
#include <cstddef>
#include <stdint.h>
@@ -7,28 +7,77 @@
namespace util {
namespace stream {
+/**
+ * Encapsulates a block of memory.
+ */
class Block {
public:
+
+ /**
+ * Constructs an empty block.
+ */
Block() : mem_(NULL), valid_size_(0) {}
+ /**
+ * Constructs a block that encapsulates a segment of memory.
+ *
+ * @param[in] mem The segment of memory to encapsulate
+ * @param[in] size The size of the memory segment in bytes
+ */
Block(void *mem, std::size_t size) : mem_(mem), valid_size_(size) {}
+ /**
+ * Set the number of bytes in this block that should be interpreted as valid.
+ *
+ * @param[in] to Number of bytes
+ */
void SetValidSize(std::size_t to) { valid_size_ = to; }
- // Read might fill in less than Allocated at EOF.
+
+ /**
+ * Gets the number of bytes in this block that should be interpreted as valid.
+ * This is important because read might fill in less than Allocated at EOF.
+ */
std::size_t ValidSize() const { return valid_size_; }
+ /** Gets a void pointer to the memory underlying this block. */
void *Get() { return mem_; }
+
+ /** Gets a const void pointer to the memory underlying this block. */
const void *Get() const { return mem_; }
+
+ /**
+ * Gets a const void pointer to the end of the valid section of memory
+ * encapsulated by this block.
+ */
const void *ValidEnd() const {
return reinterpret_cast<const uint8_t*>(mem_) + valid_size_;
}
+ /**
+ * Returns true if this block encapsulates a valid (non-NULL) block of memory.
+ *
+ * This method is a user-defined implicit conversion function to boolean;
+ * among other things, this method enables bare instances of this class
+ * to be used as the condition of an if statement.
+ */
operator bool() const { return mem_ != NULL; }
+
+ /**
+ * Returns true if this block is empty.
+ *
+ * In other words, if Get()==NULL, this method will return true.
+ */
bool operator!() const { return mem_ == NULL; }
private:
friend class Link;
+
+ /**
+ * Points this block's memory at NULL.
+ *
+ * This class defines poison as a block whose memory pointer is NULL.
+ */
void SetToPoison() {
mem_ = NULL;
}
@@ -40,4 +89,4 @@ class Block {
} // namespace stream
} // namespace util
-#endif // UTIL_STREAM_BLOCK__
+#endif // UTIL_STREAM_BLOCK_H
diff --git a/klm/util/stream/chain.cc b/klm/util/stream/chain.cc
index 46708c60..4596af7a 100644
--- a/klm/util/stream/chain.cc
+++ b/klm/util/stream/chain.cc
@@ -59,6 +59,11 @@ Chain &Chain::operator>>(const WriteAndRecycle &writer) {
return *this;
}
+Chain &Chain::operator>>(const PWriteAndRecycle &writer) {
+ threads_.push_back(new Thread(Complete(), writer));
+ return *this;
+}
+
void Chain::Wait(bool release_memory) {
if (queues_.empty()) {
assert(threads_.empty());
@@ -126,7 +131,12 @@ Link::~Link() {
// abort();
} else {
if (!poisoned_) {
- // Pass the poison!
+ // Poison is a block whose memory pointer is NULL.
+ //
+ // Because we're in the else block,
+ // we know that the memory pointer of current_ is NULL.
+ //
+ // Pass the current (poison) block!
out_->Produce(current_);
}
}
diff --git a/klm/util/stream/chain.hh b/klm/util/stream/chain.hh
index 0cc83a85..50865086 100644
--- a/klm/util/stream/chain.hh
+++ b/klm/util/stream/chain.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_CHAIN__
-#define UTIL_STREAM_CHAIN__
+#ifndef UTIL_STREAM_CHAIN_H
+#define UTIL_STREAM_CHAIN_H
#include "util/stream/block.hh"
#include "util/stream/config.hh"
@@ -24,7 +24,12 @@ class ChainConfigException : public Exception {
};
class Chain;
-// Specifies position in chain for Link constructor.
+
+/**
+ * Encapsulates a @ref PCQueue "producer queue" and a @ref PCQueue "consumer queue" within a @ref Chain "chain".
+ *
+ * Specifies position in chain for Link constructor.
+ */
class ChainPosition {
public:
const Chain &GetChain() const { return *chain_; }
@@ -41,14 +46,32 @@ class ChainPosition {
WorkerProgress progress_;
};
-// Position is usually ChainPosition but if there are multiple streams involved, this can be ChainPositions.
+
+/**
+ * Encapsulates a worker thread processing data at a given position in the chain.
+ *
+ * Each instance of this class owns one boost thread in which the worker is Run().
+ */
class Thread {
public:
+
+ /**
+ * Constructs a new Thread in which the provided Worker is Run().
+ *
+ * Position is usually ChainPosition but if there are multiple streams involved, this can be ChainPositions.
+ *
+ * After a call to this constructor, the provided worker will be running within a boost thread owned by the newly constructed Thread object.
+ */
template <class Position, class Worker> Thread(const Position &position, const Worker &worker)
: thread_(boost::ref(*this), position, worker) {}
~Thread();
+ /**
+ * Launches the provided worker in this object's boost thread.
+ *
+ * This method is called automatically by this class's @ref Thread() "constructor".
+ */
template <class Position, class Worker> void operator()(const Position &position, Worker &worker) {
try {
worker.Run(position);
@@ -63,14 +86,27 @@ class Thread {
boost::thread thread_;
};
+/**
+ * This resets blocks to full valid size. Used to close the loop in Chain by recycling blocks.
+ */
class Recycler {
public:
+ /**
+ * Resets the blocks in the chain such that the blocks' respective valid sizes match the chain's block size.
+ *
+ * @see Block::SetValidSize()
+ * @see Chain::BlockSize()
+ */
void Run(const ChainPosition &position);
};
extern const Recycler kRecycle;
class WriteAndRecycle;
-
+class PWriteAndRecycle;
+
+/**
+ * Represents a sequence of workers, through which @ref Block "blocks" can pass.
+ */
class Chain {
private:
template <class T, void (T::*ptr)(const ChainPosition &) = &T::Run> struct CheckForRun {
@@ -78,8 +114,20 @@ class Chain {
};
public:
+
+ /**
+ * Constructs a configured Chain.
+ *
+ * @param config Specifies how to configure the Chain.
+ */
explicit Chain(const ChainConfig &config);
+ /**
+ * Destructs a Chain.
+ *
+ * This method waits for the chain's threads to complete,
+ * and frees the memory held by this chain.
+ */
~Chain();
void ActivateProgress() {
@@ -91,24 +139,49 @@ class Chain {
progress_.SetTarget(target);
}
+ /**
+ * Gets the number of bytes in each record of a Block.
+ *
+ * @see ChainConfig::entry_size
+ */
std::size_t EntrySize() const {
return config_.entry_size;
}
+
+ /**
+ * Gets the inital @ref Block::ValidSize "valid size" for @ref Block "blocks" in this chain.
+ *
+ * @see Block::ValidSize
+ */
std::size_t BlockSize() const {
return block_size_;
}
- // Two ways to add to the chain: Add() or operator>>.
+ /** Two ways to add to the chain: Add() or operator>>. */
ChainPosition Add();
- // This is for adding threaded workers with a Run method.
+ /**
+ * Adds a new worker to this chain,
+ * and runs that worker in a new Thread owned by this chain.
+ *
+ * The worker must have a Run method that accepts a position argument.
+ *
+ * @see Thread::operator()()
+ */
template <class Worker> typename CheckForRun<Worker>::type &operator>>(const Worker &worker) {
assert(!complete_called_);
threads_.push_back(new Thread(Add(), worker));
return *this;
}
- // Avoid copying the worker.
+ /**
+ * Adds a new worker to this chain (but avoids copying that worker),
+ * and runs that worker in a new Thread owned by this chain.
+ *
+ * The worker must have a Run method that accepts a position argument.
+ *
+ * @see Thread::operator()()
+ */
template <class Worker> typename CheckForRun<Worker>::type &operator>>(const boost::reference_wrapper<Worker> &worker) {
assert(!complete_called_);
threads_.push_back(new Thread(Add(), worker));
@@ -122,12 +195,21 @@ class Chain {
threads_.push_back(new Thread(Complete(), kRecycle));
}
+ /**
+ * Adds a Recycler worker to this chain,
+ * and runs that worker in a new Thread owned by this chain.
+ */
Chain &operator>>(const Recycler &) {
CompleteLoop();
return *this;
}
+ /**
+ * Adds a WriteAndRecycle worker to this chain,
+ * and runs that worker in a new Thread owned by this chain.
+ */
Chain &operator>>(const WriteAndRecycle &writer);
+ Chain &operator>>(const PWriteAndRecycle &writer);
// Chains are reusable. Call Wait to wait for everything to finish and free memory.
void Wait(bool release_memory = true);
@@ -156,28 +238,87 @@ class Chain {
};
// Create the link in the worker thread using the position token.
+/**
+ * Represents a C++ style iterator over @ref Block "blocks".
+ */
class Link {
public:
+
// Either default construct and Init or just construct all at once.
+
+ /**
+ * Constructs an @ref Init "initialized" link.
+ *
+ * @see Init
+ */
+ explicit Link(const ChainPosition &position);
+
+ /**
+ * Constructs a link that must subsequently be @ref Init "initialized".
+ *
+ * @see Init
+ */
Link();
+
+ /**
+ * Initializes the link with the input @ref PCQueue "consumer queue" and output @ref PCQueue "producer queue" at a given @ref ChainPosition "position" in the @ref Chain "chain".
+ *
+ * @see Link()
+ */
void Init(const ChainPosition &position);
- explicit Link(const ChainPosition &position);
-
+ /**
+ * Destructs the link object.
+ *
+ * If necessary, this method will pass a poison block
+ * to this link's output @ref PCQueue "producer queue".
+ *
+ * @see Block::SetToPoison()
+ */
~Link();
+ /**
+ * Gets a reference to the @ref Block "block" at this link.
+ */
Block &operator*() { return current_; }
+
+ /**
+ * Gets a const reference to the @ref Block "block" at this link.
+ */
const Block &operator*() const { return current_; }
+ /**
+ * Gets a pointer to the @ref Block "block" at this link.
+ */
Block *operator->() { return &current_; }
+
+ /**
+ * Gets a const pointer to the @ref Block "block" at this link.
+ */
const Block *operator->() const { return &current_; }
+ /**
+ * Gets the link at the next @ref ChainPosition "position" in the @ref Chain "chain".
+ */
Link &operator++();
+ /**
+ * Returns true if the @ref Block "block" at this link encapsulates a valid (non-NULL) block of memory.
+ *
+ * This method is a user-defined implicit conversion function to boolean;
+ * among other things, this method enables bare instances of this class
+ * to be used as the condition of an if statement.
+ */
operator bool() const { return current_; }
+ /**
+ * @ref Block::SetToPoison() "Poisons" the @ref Block "block" at this link,
+ * and passes this now-poisoned block to this link's output @ref PCQueue "producer queue".
+ *
+ * @see Block::SetToPoison()
+ */
void Poison();
-
+
private:
Block current_;
PCQueue<Block> *in_, *out_;
@@ -195,4 +336,4 @@ inline Chain &operator>>(Chain &chain, Link &link) {
} // namespace stream
} // namespace util
-#endif // UTIL_STREAM_CHAIN__
+#endif // UTIL_STREAM_CHAIN_H
diff --git a/klm/util/stream/config.hh b/klm/util/stream/config.hh
index 1eeb3a8a..6bad36bc 100644
--- a/klm/util/stream/config.hh
+++ b/klm/util/stream/config.hh
@@ -1,32 +1,63 @@
-#ifndef UTIL_STREAM_CONFIG__
-#define UTIL_STREAM_CONFIG__
+#ifndef UTIL_STREAM_CONFIG_H
+#define UTIL_STREAM_CONFIG_H
#include <cstddef>
#include <string>
namespace util { namespace stream {
+/**
+ * Represents how a chain should be configured.
+ */
struct ChainConfig {
+
+ /** Constructs an configuration with underspecified (or default) parameters. */
ChainConfig() {}
+ /**
+ * Constructs a chain configuration object.
+ *
+ * @param [in] in_entry_size Number of bytes in each record.
+ * @param [in] in_block_count Number of blocks in the chain.
+ * @param [in] in_total_memory Total number of bytes available to the chain.
+ * This value will be divided amongst the blocks in the chain.
+ */
ChainConfig(std::size_t in_entry_size, std::size_t in_block_count, std::size_t in_total_memory)
: entry_size(in_entry_size), block_count(in_block_count), total_memory(in_total_memory) {}
+ /**
+ * Number of bytes in each record.
+ */
std::size_t entry_size;
+
+ /**
+ * Number of blocks in the chain.
+ */
std::size_t block_count;
- // Chain's constructor will make this a multiple of entry_size.
+
+ /**
+ * Total number of bytes available to the chain.
+ * This value will be divided amongst the blocks in the chain.
+ * Chain's constructor will make this a multiple of entry_size.
+ */
std::size_t total_memory;
};
+
+/**
+ * Represents how a sorter should be configured.
+ */
struct SortConfig {
+
+ /** Filename prefix where temporary files should be placed. */
std::string temp_prefix;
- // Size of each input/output buffer.
+ /** Size of each input/output buffer. */
std::size_t buffer_size;
- // Total memory to use when running alone.
+ /** Total memory to use when running alone. */
std::size_t total_memory;
};
}} // namespaces
-#endif // UTIL_STREAM_CONFIG__
+#endif // UTIL_STREAM_CONFIG_H
diff --git a/klm/util/stream/io.cc b/klm/util/stream/io.cc
index 0459f706..c64004c0 100644
--- a/klm/util/stream/io.cc
+++ b/klm/util/stream/io.cc
@@ -36,12 +36,12 @@ void PRead::Run(const ChainPosition &position) {
Link link(position);
uint64_t offset = 0;
for (; offset + block_size64 < size; offset += block_size64, ++link) {
- PReadOrThrow(file_, link->Get(), block_size, offset);
+ ErsatzPRead(file_, link->Get(), block_size, offset);
link->SetValidSize(block_size);
}
// size - offset is <= block_size, so it casts to 32-bit fine.
if (size - offset) {
- PReadOrThrow(file_, link->Get(), size - offset, offset);
+ ErsatzPRead(file_, link->Get(), size - offset, offset);
link->SetValidSize(size - offset);
++link;
}
@@ -62,5 +62,15 @@ void WriteAndRecycle::Run(const ChainPosition &position) {
}
}
+void PWriteAndRecycle::Run(const ChainPosition &position) {
+ const std::size_t block_size = position.GetChain().BlockSize();
+ uint64_t offset = 0;
+ for (Link link(position); link; ++link) {
+ ErsatzPWrite(file_, link->Get(), link->ValidSize(), offset);
+ offset += link->ValidSize();
+ link->SetValidSize(block_size);
+ }
+}
+
} // namespace stream
} // namespace util
diff --git a/klm/util/stream/io.hh b/klm/util/stream/io.hh
index 934b6b3f..8dae2cbf 100644
--- a/klm/util/stream/io.hh
+++ b/klm/util/stream/io.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_IO__
-#define UTIL_STREAM_IO__
+#ifndef UTIL_STREAM_IO_H
+#define UTIL_STREAM_IO_H
#include "util/exception.hh"
#include "util/file.hh"
@@ -41,6 +41,8 @@ class Write {
int file_;
};
+// It's a common case that stuff is written and then recycled. So rather than
+// spawn another thread to Recycle, this combines the two roles.
class WriteAndRecycle {
public:
explicit WriteAndRecycle(int fd) : file_(fd) {}
@@ -49,14 +51,23 @@ class WriteAndRecycle {
int file_;
};
+class PWriteAndRecycle {
+ public:
+ explicit PWriteAndRecycle(int fd) : file_(fd) {}
+ void Run(const ChainPosition &position);
+ private:
+ int file_;
+};
+
+
// Reuse the same file over and over again to buffer output.
class FileBuffer {
public:
explicit FileBuffer(int fd) : file_(fd) {}
- WriteAndRecycle Sink() const {
+ PWriteAndRecycle Sink() const {
util::SeekOrThrow(file_.get(), 0);
- return WriteAndRecycle(file_.get());
+ return PWriteAndRecycle(file_.get());
}
PRead Source() const {
@@ -73,4 +84,4 @@ class FileBuffer {
} // namespace stream
} // namespace util
-#endif // UTIL_STREAM_IO__
+#endif // UTIL_STREAM_IO_H
diff --git a/klm/util/stream/line_input.hh b/klm/util/stream/line_input.hh
index 86db1dd0..a870a664 100644
--- a/klm/util/stream/line_input.hh
+++ b/klm/util/stream/line_input.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_LINE_INPUT__
-#define UTIL_STREAM_LINE_INPUT__
+#ifndef UTIL_STREAM_LINE_INPUT_H
+#define UTIL_STREAM_LINE_INPUT_H
namespace util {namespace stream {
class ChainPosition;
@@ -19,4 +19,4 @@ class LineInput {
};
}} // namespaces
-#endif // UTIL_STREAM_LINE_INPUT__
+#endif // UTIL_STREAM_LINE_INPUT_H
diff --git a/klm/util/stream/multi_progress.hh b/klm/util/stream/multi_progress.hh
index c4dd45a9..82e698a5 100644
--- a/klm/util/stream/multi_progress.hh
+++ b/klm/util/stream/multi_progress.hh
@@ -1,6 +1,6 @@
/* Progress bar suitable for chains of workers */
-#ifndef UTIL_MULTI_PROGRESS__
-#define UTIL_MULTI_PROGRESS__
+#ifndef UTIL_STREAM_MULTI_PROGRESS_H
+#define UTIL_STREAM_MULTI_PROGRESS_H
#include <boost/thread/mutex.hpp>
@@ -87,4 +87,4 @@ class WorkerProgress {
}} // namespaces
-#endif // UTIL_MULTI_PROGRESS__
+#endif // UTIL_STREAM_MULTI_PROGRESS_H
diff --git a/klm/util/stream/multi_stream.hh b/klm/util/stream/multi_stream.hh
new file mode 100644
index 00000000..0ee7fab6
--- /dev/null
+++ b/klm/util/stream/multi_stream.hh
@@ -0,0 +1,127 @@
+#ifndef UTIL_STREAM_MULTI_STREAM_H
+#define UTIL_STREAM_MULTI_STREAM_H
+
+#include "util/fixed_array.hh"
+#include "util/scoped.hh"
+#include "util/stream/chain.hh"
+#include "util/stream/stream.hh"
+
+#include <cstddef>
+#include <new>
+
+#include <assert.h>
+#include <stdlib.h>
+
+namespace util { namespace stream {
+
+class Chains;
+
+class ChainPositions : public util::FixedArray<util::stream::ChainPosition> {
+ public:
+ ChainPositions() {}
+
+ void Init(Chains &chains);
+
+ explicit ChainPositions(Chains &chains) {
+ Init(chains);
+ }
+};
+
+class Chains : public util::FixedArray<util::stream::Chain> {
+ private:
+ template <class T, void (T::*ptr)(const ChainPositions &) = &T::Run> struct CheckForRun {
+ typedef Chains type;
+ };
+
+ public:
+ // Must call Init.
+ Chains() {}
+
+ explicit Chains(std::size_t limit) : util::FixedArray<util::stream::Chain>(limit) {}
+
+ template <class Worker> typename CheckForRun<Worker>::type &operator>>(const Worker &worker) {
+ threads_.push_back(new util::stream::Thread(ChainPositions(*this), worker));
+ return *this;
+ }
+
+ template <class Worker> typename CheckForRun<Worker>::type &operator>>(const boost::reference_wrapper<Worker> &worker) {
+ threads_.push_back(new util::stream::Thread(ChainPositions(*this), worker));
+ return *this;
+ }
+
+ Chains &operator>>(const util::stream::Recycler &recycler) {
+ for (util::stream::Chain *i = begin(); i != end(); ++i)
+ *i >> recycler;
+ return *this;
+ }
+
+ void Wait(bool release_memory = true) {
+ threads_.clear();
+ for (util::stream::Chain *i = begin(); i != end(); ++i) {
+ i->Wait(release_memory);
+ }
+ }
+
+ private:
+ boost::ptr_vector<util::stream::Thread> threads_;
+
+ Chains(const Chains &);
+ void operator=(const Chains &);
+};
+
+inline void ChainPositions::Init(Chains &chains) {
+ util::FixedArray<util::stream::ChainPosition>::Init(chains.size());
+ for (util::stream::Chain *i = chains.begin(); i != chains.end(); ++i) {
+ // use "placement new" syntax to initalize ChainPosition in an already-allocated memory location
+ new (end()) util::stream::ChainPosition(i->Add()); Constructed();
+ }
+}
+
+inline Chains &operator>>(Chains &chains, ChainPositions &positions) {
+ positions.Init(chains);
+ return chains;
+}
+
+template <class T> class GenericStreams : public util::FixedArray<T> {
+ private:
+ typedef util::FixedArray<T> P;
+ public:
+ GenericStreams() {}
+
+ // This puts a dummy T at the beginning (useful to algorithms that need to reference something at the beginning).
+ void InitWithDummy(const ChainPositions &positions) {
+ P::Init(positions.size() + 1);
+ new (P::end()) T(); // use "placement new" syntax to initalize T in an already-allocated memory location
+ P::Constructed();
+ for (const util::stream::ChainPosition *i = positions.begin(); i != positions.end(); ++i) {
+ P::push_back(*i);
+ }
+ }
+
+ // Limit restricts to positions[0,limit)
+ void Init(const ChainPositions &positions, std::size_t limit) {
+ P::Init(limit);
+ for (const util::stream::ChainPosition *i = positions.begin(); i != positions.begin() + limit; ++i) {
+ P::push_back(*i);
+ }
+ }
+ void Init(const ChainPositions &positions) {
+ Init(positions, positions.size());
+ }
+
+ GenericStreams(const ChainPositions &positions) {
+ Init(positions);
+ }
+};
+
+template <class T> inline Chains &operator>>(Chains &chains, GenericStreams<T> &streams) {
+ ChainPositions positions;
+ chains >> positions;
+ streams.Init(positions);
+ return chains;
+}
+
+typedef GenericStreams<Stream> Streams;
+
+}} // namespaces
+#endif // UTIL_STREAM_MULTI_STREAM_H
diff --git a/klm/util/stream/sort.hh b/klm/util/stream/sort.hh
index 16aa6a03..9082cfdd 100644
--- a/klm/util/stream/sort.hh
+++ b/klm/util/stream/sort.hh
@@ -15,8 +15,8 @@
* sort. Use a hash table for that.
*/
-#ifndef UTIL_STREAM_SORT__
-#define UTIL_STREAM_SORT__
+#ifndef UTIL_STREAM_SORT_H
+#define UTIL_STREAM_SORT_H
#include "util/stream/chain.hh"
#include "util/stream/config.hh"
@@ -182,7 +182,7 @@ template <class Compare> class MergeQueue {
amount = remaining_;
buffer_end_ = current_ + remaining_;
}
- PReadOrThrow(fd, current_, amount, offset_);
+ ErsatzPRead(fd, current_, amount, offset_);
offset_ += amount;
assert(current_ <= buffer_end_);
remaining_ -= amount;
@@ -307,10 +307,10 @@ template <class Compare, class Combine> class MergingReader {
const uint64_t block_size = position.GetChain().BlockSize();
Link l(position);
for (; offset + block_size < end; ++l, offset += block_size) {
- PReadOrThrow(in_, l->Get(), block_size, offset);
+ ErsatzPRead(in_, l->Get(), block_size, offset);
l->SetValidSize(block_size);
}
- PReadOrThrow(in_, l->Get(), end - offset, offset);
+ ErsatzPRead(in_, l->Get(), end - offset, offset);
l->SetValidSize(end - offset);
(++l).Poison();
return;
@@ -388,8 +388,10 @@ class BadSortConfig : public Exception {
~BadSortConfig() throw() {}
};
+/** Sort */
template <class Compare, class Combine = NeverCombine> class Sort {
public:
+ /** Constructs an object capable of sorting */
Sort(Chain &in, const SortConfig &config, const Compare &compare = Compare(), const Combine &combine = Combine())
: config_(config),
data_(MakeTemp(config.temp_prefix)),
@@ -545,4 +547,4 @@ template <class Compare, class Combine> uint64_t BlockingSort(Chain &chain, cons
} // namespace stream
} // namespace util
-#endif // UTIL_STREAM_SORT__
+#endif // UTIL_STREAM_SORT_H
diff --git a/klm/util/stream/stream.hh b/klm/util/stream/stream.hh
index 6ff45b82..7ea1c9f7 100644
--- a/klm/util/stream/stream.hh
+++ b/klm/util/stream/stream.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_STREAM__
-#define UTIL_STREAM_STREAM__
+#ifndef UTIL_STREAM_STREAM_H
+#define UTIL_STREAM_STREAM_H
#include "util/stream/chain.hh"
@@ -56,6 +56,9 @@ class Stream : boost::noncopyable {
end_ = current_ + block_it_->ValidSize();
}
+ // The following are pointers to raw memory
+ // current_ is the current record
+ // end_ is the end of the block (so we know when to move to the next block)
uint8_t *current_, *end_;
std::size_t entry_size_;
@@ -71,4 +74,4 @@ inline Chain &operator>>(Chain &chain, Stream &stream) {
} // namespace stream
} // namespace util
-#endif // UTIL_STREAM_STREAM__
+#endif // UTIL_STREAM_STREAM_H
diff --git a/klm/util/stream/timer.hh b/klm/util/stream/timer.hh
index 7e1a5885..06488a17 100644
--- a/klm/util/stream/timer.hh
+++ b/klm/util/stream/timer.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STREAM_TIMER__
-#define UTIL_STREAM_TIMER__
+#ifndef UTIL_STREAM_TIMER_H
+#define UTIL_STREAM_TIMER_H
// Sorry Jon, this was adding library dependencies in Moses and people complained.
@@ -13,4 +13,4 @@
#define UTIL_TIMER(str)
//#endif
-#endif // UTIL_STREAM_TIMER__
+#endif // UTIL_STREAM_TIMER_H
diff --git a/klm/util/string_piece.cc b/klm/util/string_piece.cc
index 973091c4..62694a35 100644
--- a/klm/util/string_piece.cc
+++ b/klm/util/string_piece.cc
@@ -1,2 +1 @@
-// this has been moved to utils/ in cdec
-
+// moved to cdec/utils
diff --git a/klm/util/string_piece.hh b/klm/util/string_piece.hh
index 696ca084..a49779aa 100644
--- a/klm/util/string_piece.hh
+++ b/klm/util/string_piece.hh
@@ -1,2 +1 @@
#include "utils/string_piece.hh"
-
diff --git a/klm/util/string_piece_hash.hh b/klm/util/string_piece_hash.hh
index f206b1d8..5c8c525e 100644
--- a/klm/util/string_piece_hash.hh
+++ b/klm/util/string_piece_hash.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_STRING_PIECE_HASH__
-#define UTIL_STRING_PIECE_HASH__
+#ifndef UTIL_STRING_PIECE_HASH_H
+#define UTIL_STRING_PIECE_HASH_H
#include "util/string_piece.hh"
@@ -40,4 +40,4 @@ template <class T> typename T::iterator FindStringPiece(T &t, const StringPiece
#endif
}
-#endif // UTIL_STRING_PIECE_HASH__
+#endif // UTIL_STRING_PIECE_HASH_H
diff --git a/klm/util/thread_pool.hh b/klm/util/thread_pool.hh
index 84e257ea..d1a883a0 100644
--- a/klm/util/thread_pool.hh
+++ b/klm/util/thread_pool.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_THREAD_POOL__
-#define UTIL_THREAD_POOL__
+#ifndef UTIL_THREAD_POOL_H
+#define UTIL_THREAD_POOL_H
#include "util/pcqueue.hh"
@@ -18,8 +18,8 @@ template <class HandlerT> class Worker : boost::noncopyable {
typedef HandlerT Handler;
typedef typename Handler::Request Request;
- template <class Construct> Worker(PCQueue<Request> &in, Construct &construct, Request &poison)
- : in_(in), handler_(construct), thread_(boost::ref(*this)), poison_(poison) {}
+ template <class Construct> Worker(PCQueue<Request> &in, Construct &construct, const Request &poison)
+ : in_(in), handler_(construct), poison_(poison), thread_(boost::ref(*this)) {}
// Only call from thread.
void operator()() {
@@ -30,7 +30,7 @@ template <class HandlerT> class Worker : boost::noncopyable {
try {
(*handler_)(request);
}
- catch(std::exception &e) {
+ catch(const std::exception &e) {
std::cerr << "Handler threw " << e.what() << std::endl;
abort();
}
@@ -49,10 +49,10 @@ template <class HandlerT> class Worker : boost::noncopyable {
PCQueue<Request> &in_;
boost::optional<Handler> handler_;
+
+ const Request poison_;
boost::thread thread_;
-
- Request poison_;
};
template <class HandlerT> class ThreadPool : boost::noncopyable {
@@ -92,4 +92,4 @@ template <class HandlerT> class ThreadPool : boost::noncopyable {
} // namespace util
-#endif // UTIL_THREAD_POOL__
+#endif // UTIL_THREAD_POOL_H
diff --git a/klm/util/tokenize_piece.hh b/klm/util/tokenize_piece.hh
index 24eae8fb..908c8daf 100644
--- a/klm/util/tokenize_piece.hh
+++ b/klm/util/tokenize_piece.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_TOKENIZE_PIECE__
-#define UTIL_TOKENIZE_PIECE__
+#ifndef UTIL_TOKENIZE_PIECE_H
+#define UTIL_TOKENIZE_PIECE_H
#include "util/exception.hh"
#include "util/string_piece.hh"
@@ -7,7 +7,8 @@
#include <boost/iterator/iterator_facade.hpp>
#include <algorithm>
-#include <iostream>
+
+#include <string.h>
namespace util {
@@ -71,6 +72,13 @@ class BoolCharacter {
return StringPiece(in.data() + in.size(), 0);
}
+ template <unsigned Length> static void Build(const char (&characters)[Length], bool (&out)[256]) {
+ memset(out, 0, sizeof(out));
+ for (const char *i = characters; i != characters + Length; ++i) {
+ out[static_cast<unsigned char>(*i)] = true;
+ }
+ }
+
private:
const bool *delimiter_;
};
@@ -140,4 +148,4 @@ template <class Find, bool SkipEmpty = false> class TokenIter : public boost::it
} // namespace util
-#endif // UTIL_TOKENIZE_PIECE__
+#endif // UTIL_TOKENIZE_PIECE_H
diff --git a/klm/util/unistd.hh b/klm/util/unistd.hh
new file mode 100644
index 00000000..0379c491
--- /dev/null
+++ b/klm/util/unistd.hh
@@ -0,0 +1,22 @@
+#ifndef UTIL_UNISTD_H
+#define UTIL_UNISTD_H
+
+#if defined(_WIN32) || defined(_WIN64)
+
+// Windows doesn't define <unistd.h>
+//
+// So we define what we need here instead:
+//
+#define STDIN_FILENO=0
+#define STDOUT_FILENO=1
+
+
+#else // Huzzah for POSIX!
+
+#include <unistd.h>
+
+#endif
+
+
+
+#endif // UTIL_UNISTD_H
diff --git a/klm/util/usage.cc b/klm/util/usage.cc
index e68d7c7c..2a4aa47d 100644
--- a/klm/util/usage.cc
+++ b/klm/util/usage.cc
@@ -30,6 +30,8 @@ typedef struct
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} lMEMORYSTATUSEX;
+// Is this really supposed to be defined like this?
+typedef int WINBOOL;
typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
#else
#include <sys/resource.h>
@@ -196,7 +198,7 @@ uint64_t GuessPhysicalMemory() {
#if defined(_WIN32) || defined(_WIN64)
{ /* this works on windows */
PFN_MS_EX pfnex;
- HMODULE h = GetModuleHandle ("kernel32.dll");
+ HMODULE h = GetModuleHandle (TEXT("kernel32.dll"));
if (!h)
return 0;
diff --git a/klm/util/usage.hh b/klm/util/usage.hh
index da53b9e3..e578b0a6 100644
--- a/klm/util/usage.hh
+++ b/klm/util/usage.hh
@@ -1,5 +1,5 @@
-#ifndef UTIL_USAGE__
-#define UTIL_USAGE__
+#ifndef UTIL_USAGE_H
+#define UTIL_USAGE_H
#include <cstddef>
#include <iosfwd>
#include <string>
@@ -18,4 +18,4 @@ uint64_t GuessPhysicalMemory();
// Parse a size like unix sort. Sadly, this means the default multiplier is K.
uint64_t ParseSize(const std::string &arg);
} // namespace util
-#endif // UTIL_USAGE__
+#endif // UTIL_USAGE_H
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
new file mode 100644
index 00000000..d383ad5c
--- /dev/null
+++ b/m4/ax_pthread.m4
@@ -0,0 +1,332 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro figures out how to build C programs using POSIX threads. It
+# sets the PTHREAD_LIBS output variable to the threads library and linker
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+# flags that are needed. (The user can also force certain compiler
+# flags/libs to be tested by setting these environment variables.)
+#
+# Also sets PTHREAD_CC to any special C compiler that is needed for
+# multi-threaded programs (defaults to the value of CC otherwise). (This
+# is necessary on AIX to use the special cc_r compiler alias.)
+#
+# NOTE: You are assumed to not only compile your program with these flags,
+# but also link it with them as well. e.g. you should link with
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+# If you are only building threads programs, you may wish to use these
+# variables in your default LIBS, CFLAGS, and CC:
+#
+# LIBS="$PTHREAD_LIBS $LIBS"
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+# CC="$PTHREAD_CC"
+#
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+# PTHREAD_CFLAGS.
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_PTHREAD.
+#
+# Please let the authors know if this macro fails on any platform, or if
+# you have any other suggestions or comments. This macro was based on work
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also
+# grateful for the helpful feedback of numerous users.
+#
+# Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 21
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
+ AC_MSG_RESULT([$ax_pthread_ok])
+ if test x"$ax_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case ${host_os} in
+ solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+ ;;
+
+ darwin*)
+ ax_pthread_flags="-pthread $ax_pthread_flags"
+ ;;
+esac
+
+# Clang doesn't consider unrecognized options an error unless we specify
+# -Werror. We throw in some extra Clang-specific options to ensure that
+# this doesn't happen for GCC, which also accepts -Werror.
+
+AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
+save_CFLAGS="$CFLAGS"
+ax_pthread_extra_flags="-Werror"
+CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
+ [AC_MSG_RESULT([yes])],
+ [ax_pthread_extra_flags=
+ AC_MSG_RESULT([no])])
+CFLAGS="$save_CFLAGS"
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
+ if test x"$ax_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+ static void routine(void *a) { a = 0; }
+ static void *start_routine(void *a) { return a; }],
+ [pthread_t th; pthread_attr_t attr;
+ pthread_create(&th, 0, start_routine, 0);
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_cleanup_pop(0) /* ; */])],
+ [ax_pthread_ok=yes],
+ [])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT([$ax_pthread_ok])
+ if test "x$ax_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+ [int attr = $attr; return attr /* ; */])],
+ [attr_name=$attr; break],
+ [])
+ done
+ AC_MSG_RESULT([$attr_name])
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case ${host_os} in
+ aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
+ osf* | hpux*) flag="-D_REENTRANT";;
+ solaris*)
+ if test "$GCC" = "yes"; then
+ flag="-D_REENTRANT"
+ else
+ # TODO: What about Clang on Solaris?
+ flag="-mt -D_REENTRANT"
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$flag])
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+ [ax_cv_PTHREAD_PRIO_INHERIT], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
+ [[int i = PTHREAD_PRIO_INHERIT;]])],
+ [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+ [ax_cv_PTHREAD_PRIO_INHERIT=no])
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+ [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: compile with *_r variant
+ if test "x$GCC" != xyes; then
+ case $host_os in
+ aix*)
+ AS_CASE(["x/$CC"],
+ [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
+ [#handle absolute path differently from PATH based program lookup
+ AS_CASE(["x$CC"],
+ [x/*],
+ [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
+ [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
+ ;;
+ esac
+ fi
+fi
+
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
+AC_SUBST([PTHREAD_LIBS])
+AC_SUBST([PTHREAD_CFLAGS])
+AC_SUBST([PTHREAD_CC])
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+ ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
+ :
+else
+ ax_pthread_ok=no
+ $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/m4/boost.m4 b/m4/boost.m4
index c8eb65ae..11a623dc 100644
--- a/m4/boost.m4
+++ b/m4/boost.m4
@@ -1,5 +1,5 @@
# boost.m4: Locate Boost headers and libraries for autoconf-based projects.
-# Copyright (C) 2007, 2008, 2009, 2010, 2011 Benoit Sigoure <tsuna@lrde.epita.fr>
+# Copyright (C) 2007-2011, 2014 Benoit Sigoure <tsuna@lrde.epita.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_define([_BOOST_SERIAL], [m4_translit([
-# serial 18
+# serial 23
], [#
], [])])
@@ -59,7 +59,8 @@ m4_pattern_forbid([^_?(BOOST|Boost)_])
# It could be useful to turn this into a macro which extracts the
# value of any macro.
m4_define([_BOOST_SED_CPP],
-[AC_LANG_PREPROC_REQUIRE()dnl
+[AC_LANG_PUSH([C++])dnl
+AC_LANG_PREPROC_REQUIRE()dnl
AC_REQUIRE([AC_PROG_SED])dnl
AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
AS_IF([dnl eval is necessary to expand ac_cpp.
@@ -77,7 +78,8 @@ dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK
[$3],
[$4])
rm -rf conftest*
-])# AC_EGREP_CPP
+AC_LANG_POP([C++])dnl
+])# _BOOST_SED_CPP
@@ -221,6 +223,7 @@ fi
CPPFLAGS=$boost_save_CPPFLAGS
])# BOOST_REQUIRE
+
# BOOST_STATIC()
# --------------
# Add the "--enable-static-boost" configure argument. If this argument is given
@@ -232,6 +235,7 @@ AC_DEFUN([BOOST_STATIC],
[enable_static_boost=yes],
[enable_static_boost=no])])# BOOST_STATIC
+
# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
# --------------------------------------------------------------------------
# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for
@@ -264,14 +268,16 @@ fi
])# BOOST_FIND_HEADER
-# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
-# [CXX-PROLOGUE])
-# -------------------------------------------------------------------------
-# Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for
-# libboost_thread). Check that HEADER-NAME works and check that
-# libboost_LIB-NAME can link with the code CXX-TEST. The optional argument
-# CXX-PROLOGUE can be used to include some C++ code before the `main'
-# function.
+# BOOST_FIND_LIBS([COMPONENT-NAME], [CANDIDATE-LIB-NAMES],
+# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
+# [CXX-PROLOGUE])
+# --------------------------------------------------------------
+# Look for the Boost library COMPONENT-NAME (e.g., `thread', for
+# libboost_thread) under the possible CANDIDATE-LIB-NAMES (e.g.,
+# "thread_win32 thread"). Check that HEADER-NAME works and check that
+# libboost_LIB-NAME can link with the code CXX-TEST. The optional
+# argument CXX-PROLOGUE can be used to include some C++ code before
+# the `main' function.
#
# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
#
@@ -285,7 +291,7 @@ fi
# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
# ... If you want to make sure you have a specific version of Boost
# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
-AC_DEFUN([BOOST_FIND_LIB],
+AC_DEFUN([BOOST_FIND_LIBS],
[AC_REQUIRE([BOOST_REQUIRE])dnl
AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
AC_REQUIRE([BOOST_STATIC])dnl
@@ -299,32 +305,69 @@ AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
AS_VAR_PUSHDEF([Boost_lib_LDPATH], [boost_cv_lib_$1_LDPATH])dnl
AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
-BOOST_FIND_HEADER([$3])
+BOOST_FIND_HEADER([$4])
boost_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-# Now let's try to find the library. The algorithm is as follows: first look
-# for a given library name according to the user's PREFERRED-RT-OPT. For each
-# library name, we prefer to use the ones that carry the tag (toolset name).
-# Each library is searched through the various standard paths were Boost is
-# usually installed. If we can't find the standard variants, we try to
-# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist
-# but there's -obviously- libboost_threads-mt.dylib).
AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
- [Boost_lib=no
- case "$2" in #(
- mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
- mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #(
- *) boost_mt=; boost_rtopt=$2;;
+ [_BOOST_FIND_LIBS($@)])
+case $Boost_lib in #(
+ (no) _AC_MSG_LOG_CONFTEST
+ AC_MSG_ERROR([cannot find the flags to link with Boost $1])
+ ;;
+esac
+AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl
+AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl
+AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl
+AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl
+CPPFLAGS=$boost_save_CPPFLAGS
+AS_VAR_POPDEF([Boost_lib])dnl
+AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
+AS_VAR_POPDEF([Boost_lib_LDPATH])dnl
+AS_VAR_POPDEF([Boost_lib_LIBS])dnl
+AC_LANG_POP([C++])dnl
+fi
+])
+
+
+# BOOST_FIND_LIB([LIB-NAME],
+# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
+# [CXX-PROLOGUE])
+# --------------------------------------------------------------
+# Backward compatibility wrapper for BOOST_FIND_LIBS.
+AC_DEFUN([BOOST_FIND_LIB],
+[BOOST_FIND_LIBS([$1], $@)])
+
+
+# _BOOST_FIND_LIBS([LIB-NAME], [CANDIDATE-LIB-NAMES],
+# [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
+# [CXX-PROLOGUE])
+# --------------------------------------------------------------
+# Real implementation of BOOST_FIND_LIBS: rely on these local macros:
+# Boost_lib, Boost_lib_LDFLAGS, Boost_lib_LDPATH, Boost_lib_LIBS
+#
+# The algorithm is as follows: first look for a given library name
+# according to the user's PREFERRED-RT-OPT. For each library name, we
+# prefer to use the ones that carry the tag (toolset name). Each
+# library is searched through the various standard paths were Boost is
+# usually installed. If we can't find the standard variants, we try
+# to enforce -mt (for instance on MacOSX, libboost_thread.dylib
+# doesn't exist but there's -obviously- libboost_thread-mt.dylib).
+AC_DEFUN([_BOOST_FIND_LIBS],
+[Boost_lib=no
+ case "$3" in #(
+ (mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
+ (mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$3" : 'Xmt-*\(.*\)'`;; #(
+ (*) boost_mt=; boost_rtopt=$3;;
esac
if test $enable_static_boost = yes; then
boost_rtopt="s$boost_rtopt"
fi
# Find the proper debug variant depending on what we've been asked to find.
case $boost_rtopt in #(
- *d*) boost_rt_d=$boost_rtopt;; #(
- *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
+ (*d*) boost_rt_d=$boost_rtopt;; #(
+ (*[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
- *) boost_rt_d='-d';;
+ (*) boost_rt_d='-d';;
esac
# If the PREFERRED-RT-OPT are not empty, prepend a `-'.
test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
@@ -335,8 +378,8 @@ AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
boost_save_ac_objext=$ac_objext
# Generate the test file.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>
-$5], [$4])])
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$4>
+$6], [$5])])
dnl Optimization hacks: compiling C++ is slow, especially with Boost. What
dnl we're trying to do here is guess the right combination of link flags
dnl (LIBS / LDFLAGS) to use a given library. This can take several
@@ -358,21 +401,22 @@ dnl start the for loops).
[AC_MSG_ERROR([cannot compile a test that uses Boost $1])])
ac_objext=$boost_save_ac_objext
boost_failed_libs=
-# Don't bother to ident the 6 nested for loops, only the 2 innermost ones
-# matter.
+# Don't bother to ident the following nested for loops, only the 2
+# innermost ones matter.
+for boost_lib_ in $2; do
for boost_tag_ in -$boost_cv_lib_tag ''; do
for boost_ver_ in -$boost_cv_lib_version ''; do
for boost_mt_ in $boost_mt -mt ''; do
for boost_rtopt_ in $boost_rtopt '' -d; do
for boost_lib in \
- boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
- boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \
- boost_$1$boost_tag_$boost_mt_$boost_ver_ \
- boost_$1$boost_tag_$boost_ver_
+ boost_$boost_lib_$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
+ boost_$boost_lib_$boost_tag_$boost_rtopt_$boost_ver_ \
+ boost_$boost_lib_$boost_tag_$boost_mt_$boost_ver_ \
+ boost_$boost_lib_$boost_tag_$boost_ver_
do
# Avoid testing twice the same lib
case $boost_failed_libs in #(
- *@$boost_lib@*) continue;;
+ (*@$boost_lib@*) continue;;
esac
# If with_boost is empty, we'll search in /lib first, which is not quite
# right so instead we'll try to a location based on where the headers are.
@@ -382,14 +426,17 @@ for boost_rtopt_ in $boost_rtopt '' -d; do
/opt/local/lib* /usr/local/lib* /opt/lib* /usr/lib* \
"$with_boost" C:/Boost/lib /lib*
do
- test -e "$boost_ldpath" || continue
+ # Don't waste time with directories that don't exist.
+ if test x"$boost_ldpath" != x && test ! -e "$boost_ldpath"; then
+ continue
+ fi
boost_save_LDFLAGS=$LDFLAGS
# Are we looking for a static library?
case $boost_ldpath:$boost_rtopt_ in #(
- *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
+ (*?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
test -e "$Boost_lib_LIBS" || continue;; #(
- *) # No: use -lboost_foo to find the shared library.
+ (*) # No: use -lboost_foo to find the shared library.
Boost_lib_LIBS="-l$boost_lib";;
esac
boost_save_LIBS=$LIBS
@@ -403,27 +450,35 @@ dnl generated only once above (before we start the for loops).
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
if test x"$Boost_lib" = xyes; then
- # Check or used cached result of whether or not using -R or -rpath makes sense.
- # Some implementations of ld, such as for Mac OSX, require -rpath but
- # -R is the flag known to work on other systems.
- # https://github.com/tsuna/boost.m4/issues/19
+ # Check or used cached result of whether or not using -R or
+ # -rpath makes sense. Some implementations of ld, such as for
+ # Mac OSX, require -rpath but -R is the flag known to work on
+ # other systems. https://github.com/tsuna/boost.m4/issues/19
AC_CACHE_VAL([boost_cv_rpath_link_ldflag],
- [for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do
- LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
- LIBS="$boost_save_LIBS $Boost_lib_LIBS"
- _BOOST_AC_LINK_IFELSE([],
- [boost_rpath_link_ldflag_found=yes
- break],
- [boost_rpath_link_ldflag_found=no])
- done
+ [case $boost_ldpath in
+ '') # Nothing to do.
+ boost_cv_rpath_link_ldflag=
+ boost_rpath_link_ldflag_found=yes;;
+ *)
+ for boost_cv_rpath_link_ldflag in -Wl,-R, -Wl,-rpath,; do
+ LDFLAGS="$boost_save_LDFLAGS -L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
+ LIBS="$boost_save_LIBS $Boost_lib_LIBS"
+ _BOOST_AC_LINK_IFELSE([],
+ [boost_rpath_link_ldflag_found=yes
+ break],
+ [boost_rpath_link_ldflag_found=no])
+ done
+ ;;
+ esac
AS_IF([test "x$boost_rpath_link_ldflag_found" != "xyes"],
[AC_MSG_ERROR([Unable to determine whether to use -R or -rpath])])
LDFLAGS=$boost_save_LDFLAGS
LIBS=$boost_save_LIBS
])
- Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
+ test x"$boost_ldpath" != x &&
+ Boost_lib_LDFLAGS="-L$boost_ldpath $boost_cv_rpath_link_ldflag$boost_ldpath"
Boost_lib_LDPATH="$boost_ldpath"
- break 6
+ break 7
else
boost_failed_libs="$boost_failed_libs@$boost_lib@"
fi
@@ -433,25 +488,10 @@ done
done
done
done
+done # boost_lib_
rm -f conftest.$ac_objext
])
-case $Boost_lib in #(
- no) _AC_MSG_LOG_CONFTEST
- AC_MSG_ERROR([cannot find the flags to link with Boost $1])
- ;;
-esac
-AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])dnl
-AC_SUBST(AS_TR_CPP([BOOST_$1_LDPATH]), [$Boost_lib_LDPATH])dnl
-AC_SUBST([BOOST_LDPATH], [$Boost_lib_LDPATH])dnl
-AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])dnl
-CPPFLAGS=$boost_save_CPPFLAGS
-AS_VAR_POPDEF([Boost_lib])dnl
-AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
-AS_VAR_POPDEF([Boost_lib_LDPATH])dnl
-AS_VAR_POPDEF([Boost_lib_LIBS])dnl
-AC_LANG_POP([C++])dnl
-fi
-])# BOOST_FIND_LIB
+
# --------------------------------------- #
@@ -493,20 +533,20 @@ BOOST_FIND_HEADER([boost/asio.hpp])])
# BOOST_BIND()
# ------------
-# Look for Boost.Bind
+# Look for Boost.Bind.
BOOST_DEFUN([Bind],
[BOOST_FIND_HEADER([boost/bind.hpp])])
# BOOST_CHRONO()
-# ------------------
-# Look for Boost.Chrono
+# --------------
+# Look for Boost.Chrono.
BOOST_DEFUN([Chrono],
[# Do we have to check for Boost.System? This link-time dependency was
# added as of 1.35.0. If we have a version <1.35, we must not attempt to
# find Boost.System as it didn't exist by then.
if test $boost_major_version -ge 135; then
-BOOST_SYSTEM([$1])
+ BOOST_SYSTEM([$1])
fi # end of the Boost.System check.
boost_filesystem_save_LIBS=$LIBS
boost_filesystem_save_LDFLAGS=$LDFLAGS
@@ -517,11 +557,10 @@ BOOST_FIND_LIB([chrono], [$1],
[boost/chrono.hpp],
[boost::chrono::thread_clock d;])
if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
- AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"])
+ BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
fi
LIBS=$boost_filesystem_save_LIBS
LDFLAGS=$boost_filesystem_save_LDFLAGS
-
])# BOOST_CHRONO
@@ -564,7 +603,7 @@ BOOST_DEFUN([Filesystem],
# added as of 1.35.0. If we have a version <1.35, we must not attempt to
# find Boost.System as it didn't exist by then.
if test $boost_major_version -ge 135; then
-BOOST_SYSTEM([$1])
+ BOOST_SYSTEM([$1])
fi # end of the Boost.System check.
boost_filesystem_save_LIBS=$LIBS
boost_filesystem_save_LDFLAGS=$LDFLAGS
@@ -574,23 +613,34 @@ LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
BOOST_FIND_LIB([filesystem], [$1],
[boost/filesystem/path.hpp], [boost::filesystem::path p;])
if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
- AC_SUBST([BOOST_FILESYSTEM_LIBS], ["$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"])
+ BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
fi
LIBS=$boost_filesystem_save_LIBS
LDFLAGS=$boost_filesystem_save_LDFLAGS
])# BOOST_FILESYSTEM
+# BOOST_FLYWEIGHT()
+# -----------------
+# Look for Boost.Flyweight.
+BOOST_DEFUN([Flyweight],
+[dnl There's a hidden dependency on pthreads.
+AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
+BOOST_FIND_HEADER([boost/flyweight.hpp])
+AC_SUBST([BOOST_FLYWEIGHT_LIBS], [$boost_cv_pthread_flag])
+])
+
+
# BOOST_FOREACH()
# ---------------
-# Look for Boost.Foreach
+# Look for Boost.Foreach.
BOOST_DEFUN([Foreach],
[BOOST_FIND_HEADER([boost/foreach.hpp])])
# BOOST_FORMAT()
# --------------
-# Look for Boost.Format
+# Look for Boost.Format.
# Note: we can't check for boost/format/format_fwd.hpp because the header isn't
# standalone. It can't be compiled because it triggers the following error:
# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
@@ -651,7 +701,7 @@ BOOST_DEFUN([Lambda],
# BOOST_LOG([PREFERRED-RT-OPT])
# -----------------------------
-# Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the
+# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Log],
[BOOST_FIND_LIB([log], [$1],
@@ -662,12 +712,12 @@ BOOST_DEFUN([Log],
# BOOST_LOG_SETUP([PREFERRED-RT-OPT])
# -----------------------------------
-# Look for Boost.Log For the documentation of PREFERRED-RT-OPT, see the
+# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Log_Setup],
[AC_REQUIRE([BOOST_LOG])dnl
BOOST_FIND_LIB([log_setup], [$1],
- [boost/log/utility/init/from_settings.hpp],
+ [boost/log/utility/setup/from_settings.hpp],
[boost::log::basic_settings<char> bs; bs.empty();])
])# BOOST_LOG_SETUP
@@ -684,6 +734,29 @@ BOOST_DEFUN([Math],
[BOOST_FIND_HEADER([boost/math/special_functions.hpp])])
+# BOOST_MPI([PREFERRED-RT-OPT])
+# -------------------------------
+# Look for Boost MPI. For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above. Uses MPICXX variable if it is
+# set, otherwise tries CXX
+#
+BOOST_DEFUN([MPI],
+[boost_save_CXX=${CXX}
+boost_save_CXXCPP=${CXXCPP}
+if test x"${MPICXX}" != x; then
+ CXX=${MPICXX}
+ CXXCPP="${MPICXX} -E"
+fi
+BOOST_FIND_LIB([mpi], [$1],
+ [boost/mpi.hpp],
+ [int argc = 0;
+ char **argv = 0;
+ boost::mpi::environment env(argc,argv);])
+CXX=${boost_save_CXX}
+CXXCPP=${boost_save_CXXCPP}
+])# BOOST_MPI
+
+
# BOOST_MULTIARRAY()
# ------------------
# Look for Boost.MultiArray
@@ -691,6 +764,14 @@ BOOST_DEFUN([MultiArray],
[BOOST_FIND_HEADER([boost/multi_array.hpp])])
+# BOOST_NUMERIC_UBLAS()
+# --------------------------
+# Look for Boost.NumericUblas (Basic Linear Algebra)
+BOOST_DEFUN([Numeric_Ublas],
+[BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp])
+])# BOOST_NUMERIC_UBLAS
+
+
# BOOST_NUMERIC_CONVERSION()
# --------------------------
# Look for Boost.NumericConversion (policy-based numeric conversion)
@@ -759,9 +840,9 @@ BOOST_DEFUN([Python],
_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
_BOOST_PYTHON_CONFIG([LIBS], [libs])
m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
-BOOST_FIND_LIB([python], [$1],
- [boost/python.hpp],
- [], [BOOST_PYTHON_MODULE(empty) {}])
+BOOST_FIND_LIBS([python], [python python3], [$1],
+ [boost/python.hpp],
+ [], [BOOST_PYTHON_MODULE(empty) {}])
CPPFLAGS=$boost_python_save_CPPFLAGS
LDFLAGS=$boost_python_save_LDFLAGS
LIBS=$boost_python_save_LIBS
@@ -867,19 +948,18 @@ BOOST_FIND_LIB([unit_test_framework], [$1],
])# BOOST_TEST
-# BOOST_THREADS([PREFERRED-RT-OPT])
+# BOOST_THREAD([PREFERRED-RT-OPT])
# ---------------------------------
# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
-# FIXME: Provide an alias "BOOST_THREAD".
-BOOST_DEFUN([Threads],
+BOOST_DEFUN([Thread],
[dnl Having the pthread flag is required at least on GCC3 where
dnl boost/thread.hpp would complain if we try to compile without
dnl -pthread on GNU/Linux.
AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
-boost_threads_save_LIBS=$LIBS
-boost_threads_save_LDFLAGS=$LDFLAGS
-boost_threads_save_CPPFLAGS=$CPPFLAGS
+boost_thread_save_LIBS=$LIBS
+boost_thread_save_LDFLAGS=$LDFLAGS
+boost_thread_save_CPPFLAGS=$CPPFLAGS
# Link-time dependency from thread to system was added as of 1.49.0.
if test $boost_major_version -ge 149; then
BOOST_SYSTEM([$1])
@@ -887,36 +967,26 @@ fi # end of the Boost.System check.
m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
LIBS="$LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
-# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
-# boost/thread.hpp will trigger a #error if -pthread isn't used:
-# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
-# is not turned on. Please set the correct command line options for
-# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
# When compiling for the Windows platform, the threads library is named
# differently.
case $host_os in
- (*mingw*)
- BOOST_FIND_LIB([thread_win32], [$1],
- [boost/thread.hpp], [boost::thread t; boost::mutex m;])
- BOOST_THREAD_LDFLAGS=$BOOST_THREAD_WIN32_LDFLAGS
- BOOST_THREAD_LDPATH=$BOOST_THREAD_WIN32_LDPATH
- BOOST_THREAD_LIBS=$BOOST_THREAD_WIN32_LIBS
- ;;
- (*)
- BOOST_FIND_LIB([thread], [$1],
- [boost/thread.hpp], [boost::thread t; boost::mutex m;])
- ;;
+ (*mingw*) boost_thread_lib_ext=_win32;;
esac
+BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
+ [$1],
+ [boost/thread.hpp], [boost::thread t; boost::mutex m;])
BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
-LIBS=$boost_threads_save_LIBS
-LDFLAGS=$boost_threads_save_LDFLAGS
-CPPFLAGS=$boost_threads_save_CPPFLAGS
-])# BOOST_THREADS
+LIBS=$boost_thread_save_LIBS
+LDFLAGS=$boost_thread_save_LDFLAGS
+CPPFLAGS=$boost_thread_save_CPPFLAGS
+])# BOOST_THREAD
+
+AU_ALIAS([BOOST_THREADS], [BOOST_THREAD])
# BOOST_TOKENIZER()
@@ -964,7 +1034,8 @@ BOOST_DEFUN([Variant],
[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
BOOST_FIND_HEADER([boost/variant.hpp])])
-# BOOST_POINTERCONTAINER()
+
+# BOOST_POINTER_CONTAINER()
# ------------------------
# Look for Boost.PointerContainer
BOOST_DEFUN([Pointer_Container],
@@ -974,12 +1045,13 @@ BOOST_FIND_HEADER([boost/ptr_container/ptr_vector.hpp])
BOOST_FIND_HEADER([boost/ptr_container/ptr_array.hpp])
BOOST_FIND_HEADER([boost/ptr_container/ptr_set.hpp])
BOOST_FIND_HEADER([boost/ptr_container/ptr_map.hpp])
-])# BOOST_POINTERCONTAINER
+])# BOOST_POINTER_CONTAINER
+
# BOOST_WAVE([PREFERRED-RT-OPT])
# ------------------------------
# NOTE: If you intend to use Wave/Spirit with thread support, make sure you
-# call BOOST_THREADS first.
+# call BOOST_THREAD first.
# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Wave],
@@ -1014,8 +1086,16 @@ BOOST_DEFUN([Xpressive],
# _BOOST_PTHREAD_FLAG()
# ---------------------
-# Internal helper for BOOST_THREADS. Based on ACX_PTHREAD:
-# http://autoconf-archive.cryp.to/acx_pthread.html
+# Internal helper for BOOST_THREAD. Computes boost_cv_pthread_flag
+# which must be used in CPPFLAGS and LIBS.
+#
+# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
+# boost/thread.hpp will trigger a #error if -pthread isn't used:
+# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
+# is not turned on. Please set the correct command line options for
+# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
+#
+# Based on ACX_PTHREAD: http://autoconf-archive.cryp.to/acx_pthread.html
AC_DEFUN([_BOOST_PTHREAD_FLAG],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
@@ -1083,6 +1163,14 @@ AC_LANG_POP([C++])dnl
m4_define([_BOOST_gcc_test],
["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
+# _BOOST_mingw_test(MAJOR, MINOR)
+# -----------------------------
+# Internal helper for _BOOST_FIND_COMPILER_TAG.
+m4_define([_BOOST_mingw_test],
+["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC && \
+ (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
+ || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw$1$2"])dnl
+
# _BOOST_FIND_COMPILER_TAG()
# --------------------------
@@ -1092,7 +1180,8 @@ m4_define([_BOOST_gcc_test],
AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
+AC_CACHE_CHECK([for the toolset name used by Boost for $CXX],
+ [boost_cv_lib_tag],
[boost_cv_lib_tag=unknown
if test x$boost_cv_inc_path != xno; then
AC_LANG_PUSH([C++])dnl
@@ -1110,14 +1199,27 @@ if test x$boost_cv_inc_path != xno; then
# I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
# the same defines as GCC's).
for i in \
+ _BOOST_mingw_test(4, 10) \
+ _BOOST_gcc_test(4, 10) \
+ _BOOST_mingw_test(4, 9) \
+ _BOOST_gcc_test(4, 9) \
+ _BOOST_mingw_test(4, 8) \
_BOOST_gcc_test(4, 8) \
+ _BOOST_mingw_test(4, 7) \
_BOOST_gcc_test(4, 7) \
+ _BOOST_mingw_test(4, 6) \
_BOOST_gcc_test(4, 6) \
+ _BOOST_mingw_test(4, 5) \
_BOOST_gcc_test(4, 5) \
+ _BOOST_mingw_test(4, 4) \
_BOOST_gcc_test(4, 4) \
+ _BOOST_mingw_test(4, 3) \
_BOOST_gcc_test(4, 3) \
+ _BOOST_mingw_test(4, 2) \
_BOOST_gcc_test(4, 2) \
+ _BOOST_mingw_test(4, 1) \
_BOOST_gcc_test(4, 1) \
+ _BOOST_mingw_test(4, 0) \
_BOOST_gcc_test(4, 0) \
"defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
&& (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
@@ -1183,6 +1285,7 @@ fi])dnl end of AC_CACHE_CHECK
# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly.
AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
[# Check whether we do better use `mt' even though we weren't ask to.
+AC_LANG_PUSH([C++])dnl
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined _REENTRANT || defined _MT || defined __MT__
/* use -mt */
@@ -1190,6 +1293,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# error MT not needed
#endif
]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
+AC_LANG_POP([C++])dnl
])
# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
@@ -1213,11 +1317,11 @@ boost_use_source=:
test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
_AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
AS_IF([_AC_DO_STDERR($ac_link) && {
- test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
- test ! -s conftest.err
+ test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
+ test ! -s conftest.err
} && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_executable_p conftest$ac_exeext
+ test "$cross_compiling" = yes ||
+ $as_executable_p conftest$ac_exeext
dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
}],
[$2],
diff --git a/mteval/Makefile.am b/mteval/Makefile.am
index c833eb01..aac3e6b5 100644
--- a/mteval/Makefile.am
+++ b/mteval/Makefile.am
@@ -14,6 +14,7 @@ libmteval_a_SOURCES = \
aer_scorer.h \
comb_scorer.h \
external_scorer.h \
+ levenshtein.h \
ns.h \
ns_cer.h \
ns_comb.h \
@@ -21,6 +22,7 @@ libmteval_a_SOURCES = \
ns_ext.h \
ns_ssk.h \
ns_ter.h \
+ ns_wer.h \
scorer.h \
ter.h \
aer_scorer.cc \
@@ -34,6 +36,7 @@ libmteval_a_SOURCES = \
ns_ext.cc \
ns_ssk.cc \
ns_ter.cc \
+ ns_wer.cc \
scorer.cc \
ter.cc
diff --git a/mteval/aer_scorer.h b/mteval/aer_scorer.h
index 6d53d359..cd1238f3 100644
--- a/mteval/aer_scorer.h
+++ b/mteval/aer_scorer.h
@@ -1,5 +1,5 @@
-#ifndef _AER_SCORER_
-#define _AER_SCORER_
+#ifndef AER_SCORER_
+#define AER_SCORER_
#include <boost/shared_ptr.hpp>
diff --git a/mteval/comb_scorer.h b/mteval/comb_scorer.h
index 346be576..d17d089d 100644
--- a/mteval/comb_scorer.h
+++ b/mteval/comb_scorer.h
@@ -1,5 +1,5 @@
-#ifndef _COMB_SCORER_
-#define _COMB_SCORER_
+#ifndef COMB_SCORER_H_
+#define COMB_SCORER_H_
#include "scorer.h"
diff --git a/mteval/external_scorer.h b/mteval/external_scorer.h
index 85535655..9565d5af 100644
--- a/mteval/external_scorer.h
+++ b/mteval/external_scorer.h
@@ -1,5 +1,5 @@
-#ifndef _EXTERNAL_SCORER_H_
-#define _EXTERNAL_SCORER_H_
+#ifndef EXTERNAL_SCORER_H_
+#define EXTERNAL_SCORER_H_
#include <vector>
#include <string>
diff --git a/mteval/levenshtein.h b/mteval/levenshtein.h
new file mode 100644
index 00000000..3ae56cf5
--- /dev/null
+++ b/mteval/levenshtein.h
@@ -0,0 +1,29 @@
+#ifndef LEVENSHTEIN_H_
+#define LEVENSHTEIN_H_
+
+namespace cdec {
+
+template <typename V>
+inline unsigned LevenshteinDistance(const V& a, const V& b) {
+ const unsigned m = a.size(), n = b.size();
+ std::vector<unsigned> edit((m + 1) * 2);
+ for (unsigned i = 0; i <= n; i++) {
+ for (unsigned j = 0; j <= m; j++) {
+ if (i == 0)
+ edit[j] = j;
+ else if (j == 0)
+ edit[(i % 2) * (m + 1)] = i;
+ else
+ edit[(i % 2) * (m + 1) + j] = std::min(std::min(
+ edit[(i % 2) * (m + 1) + j - 1] + 1,
+ edit[((i - 1) % 2) * (m + 1) + j] + 1),
+ edit[((i - 1) % 2) * (m + 1) + (j - 1)]
+ + (a[j - 1] == b[i - 1] ? 0 : 1));
+ }
+ }
+ return edit[(n % 2) * (m + 1) + m];
+}
+
+}
+
+#endif
diff --git a/mteval/ns.cc b/mteval/ns.cc
index c1ea238b..075e0121 100644
--- a/mteval/ns.cc
+++ b/mteval/ns.cc
@@ -3,6 +3,7 @@
#include "ns_ext.h"
#include "ns_comb.h"
#include "ns_cer.h"
+#include "ns_wer.h"
#include "ns_ssk.h"
#include <cstdio>
@@ -285,6 +286,8 @@ EvaluationMetric* EvaluationMetric::Instance(const string& imetric_id) {
m = new CombinationMetric(metric_id);
} else if (metric_id == "CER") {
m = new CERMetric;
+ } else if (metric_id == "WER") {
+ m = new WERMetric;
} else {
cerr << "Implement please: " << metric_id << endl;
abort();
diff --git a/mteval/ns.h b/mteval/ns.h
index 153bf0b8..f6329b65 100644
--- a/mteval/ns.h
+++ b/mteval/ns.h
@@ -1,5 +1,5 @@
-#ifndef _NS_H_
-#define _NS_H_
+#ifndef NS_H_
+#define NS_H_
#include <string>
#include <vector>
diff --git a/mteval/ns_cer.cc b/mteval/ns_cer.cc
index a843d471..da6683b1 100644
--- a/mteval/ns_cer.cc
+++ b/mteval/ns_cer.cc
@@ -1,5 +1,6 @@
#include "ns_cer.h"
#include "tdict.h"
+#include "levenshtein.h"
static const unsigned kNUMFIELDS = 2;
static const unsigned kEDITDISTANCE = 0;
@@ -13,27 +14,6 @@ unsigned CERMetric::SufficientStatisticsVectorSize() const {
return 2;
}
-unsigned CERMetric::EditDistance(const std::string& hyp,
- const std::string& ref) const {
- const unsigned m = hyp.size(), n = ref.size();
- std::vector<unsigned> edit((m + 1) * 2);
- for(unsigned i = 0; i < n + 1; i++) {
- for(unsigned j = 0; j < m + 1; j++) {
- if(i == 0)
- edit[j] = j;
- else if(j == 0)
- edit[(i%2)*(m+1)] = i;
- else
- edit[(i%2)*(m+1) + j] = std::min(std::min(edit[(i%2)*(m+1) + j-1] + 1,
- edit[((i-1)%2)*(m+1) + j] + 1),
- edit[((i-1)%2)*(m+1) + (j-1)]
- + (hyp[j-1] == ref[i-1] ? 0 : 1));
-
- }
- }
- return edit[(n%2)*(m+1) + m];
-}
-
void CERMetric::ComputeSufficientStatistics(const std::vector<WordID>& hyp,
const std::vector<std::vector<WordID> >& refs,
SufficientStats* out) const {
@@ -42,7 +22,7 @@ void CERMetric::ComputeSufficientStatistics(const std::vector<WordID>& hyp,
float best_score = hyp_str.size();
for (size_t i = 0; i < refs.size(); ++i) {
std::string ref_str(TD::GetString(refs[i]));
- float score = EditDistance(hyp_str, ref_str);
+ float score = cdec::LevenshteinDistance(hyp_str, ref_str);
if (score < best_score) {
out->fields[kEDITDISTANCE] = score;
out->fields[kCHARCOUNT] = ref_str.size();
@@ -50,6 +30,8 @@ void CERMetric::ComputeSufficientStatistics(const std::vector<WordID>& hyp,
}
}
}
+
float CERMetric::ComputeScore(const SufficientStats& stats) const {
return stats.fields[kEDITDISTANCE] / stats.fields[kCHARCOUNT];
}
+
diff --git a/mteval/ns_cer.h b/mteval/ns_cer.h
index 9d211181..d9927f78 100644
--- a/mteval/ns_cer.h
+++ b/mteval/ns_cer.h
@@ -1,13 +1,10 @@
-#ifndef _NS_CER_H_
-#define _NS_CER_H_
+#ifndef NS_CER_H_
+#define NS_CER_H_
#include "ns.h"
class CERMetric : public EvaluationMetric {
friend class EvaluationMetric;
- private:
- unsigned EditDistance(const std::string& hyp,
- const std::string& ref) const;
protected:
CERMetric() : EvaluationMetric("CER") {}
diff --git a/mteval/ns_comb.h b/mteval/ns_comb.h
index 140e7e6a..22cba169 100644
--- a/mteval/ns_comb.h
+++ b/mteval/ns_comb.h
@@ -1,5 +1,5 @@
-#ifndef _NS_COMB_H_
-#define _NS_COMB_H_
+#ifndef NS_COMB_H_
+#define NS_COMB_H_
#include "ns.h"
diff --git a/mteval/ns_docscorer.h b/mteval/ns_docscorer.h
index b3c28fc9..5feae2df 100644
--- a/mteval/ns_docscorer.h
+++ b/mteval/ns_docscorer.h
@@ -1,5 +1,5 @@
-#ifndef _NS_DOC_SCORER_H_
-#define _NS_DOC_SCORER_H_
+#ifndef NS_DOC_SCORER_H_
+#define NS_DOC_SCORER_H_
#include <vector>
#include <string>
diff --git a/mteval/ns_ext.h b/mteval/ns_ext.h
index 78badb2e..77be14b9 100644
--- a/mteval/ns_ext.h
+++ b/mteval/ns_ext.h
@@ -1,5 +1,5 @@
-#ifndef _NS_EXTERNAL_SCORER_H_
-#define _NS_EXTERNAL_SCORER_H_
+#ifndef NS_EXTERNAL_SCORER_H_
+#define NS_EXTERNAL_SCORER_H_
#include "ns.h"
diff --git a/mteval/ns_ssk.h b/mteval/ns_ssk.h
index 0d418770..fdace6eb 100644
--- a/mteval/ns_ssk.h
+++ b/mteval/ns_ssk.h
@@ -1,5 +1,5 @@
-#ifndef _NS_SSK_H_
-#define _NS_SSK_H_
+#ifndef NS_SSK_H_
+#define NS_SSK_H_
#include "ns.h"
diff --git a/mteval/ns_ter.h b/mteval/ns_ter.h
index c5c25413..cffd1bd7 100644
--- a/mteval/ns_ter.h
+++ b/mteval/ns_ter.h
@@ -1,5 +1,5 @@
-#ifndef _NS_TER_H_
-#define _NS_TER_H_
+#ifndef NS_TER_H_
+#define NS_TER_H_
#include "ns.h"
diff --git a/mteval/ns_wer.cc b/mteval/ns_wer.cc
new file mode 100644
index 00000000..f9b2bbbb
--- /dev/null
+++ b/mteval/ns_wer.cc
@@ -0,0 +1,35 @@
+#include "ns_wer.h"
+#include "tdict.h"
+#include "levenshtein.h"
+
+static const unsigned kNUMFIELDS = 2;
+static const unsigned kEDITDISTANCE = 0;
+static const unsigned kCHARCOUNT = 1;
+
+bool WERMetric::IsErrorMetric() const {
+ return true;
+}
+
+unsigned WERMetric::SufficientStatisticsVectorSize() const {
+ return 2;
+}
+
+void WERMetric::ComputeSufficientStatistics(const std::vector<WordID>& hyp,
+ const std::vector<std::vector<WordID> >& refs,
+ SufficientStats* out) const {
+ out->fields.resize(kNUMFIELDS);
+ float best_score = hyp.size();
+ for (size_t i = 0; i < refs.size(); ++i) {
+ float score = cdec::LevenshteinDistance(hyp, refs[i]);
+ if (score < best_score) {
+ out->fields[kEDITDISTANCE] = score;
+ out->fields[kCHARCOUNT] = refs[i].size();
+ best_score = score;
+ }
+ }
+}
+
+float WERMetric::ComputeScore(const SufficientStats& stats) const {
+ return stats.fields[kEDITDISTANCE] / stats.fields[kCHARCOUNT];
+}
+
diff --git a/mteval/ns_wer.h b/mteval/ns_wer.h
new file mode 100644
index 00000000..45da70c5
--- /dev/null
+++ b/mteval/ns_wer.h
@@ -0,0 +1,20 @@
+#ifndef NS_WER_H_
+#define NS_WER_H_
+
+#include "ns.h"
+
+class WERMetric : public EvaluationMetric {
+ friend class EvaluationMetric;
+ protected:
+ WERMetric() : EvaluationMetric("WER") {}
+
+ public:
+ virtual bool IsErrorMetric() const;
+ virtual unsigned SufficientStatisticsVectorSize() const;
+ virtual void ComputeSufficientStatistics(const std::vector<WordID>& hyp,
+ const std::vector<std::vector<WordID> >& refs,
+ SufficientStats* out) const;
+ virtual float ComputeScore(const SufficientStats& stats) const;
+};
+
+#endif
diff --git a/mteval/ter.h b/mteval/ter.h
index 43314791..0758c6b6 100644
--- a/mteval/ter.h
+++ b/mteval/ter.h
@@ -1,5 +1,5 @@
-#ifndef _TER_H_
-#define _TER_H_
+#ifndef TER_H_
+#define TER_H_
#include "scorer.h"
diff --git a/python/cdec/_cdec.cpp b/python/cdec/_cdec.cpp
index 03b22bb1..e76eb468 100644
--- a/python/cdec/_cdec.cpp
+++ b/python/cdec/_cdec.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19.1 on Sat May 17 14:41:25 2014 */
+/* Generated by Cython 0.21 */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -16,10 +16,11 @@
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
-#elif PY_VERSION_HEX < 0x02040000
- #error Cython requires Python 2.4+.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
#else
-#include <stddef.h> /* For offsetof */
+#define CYTHON_ABI "0_21"
+#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
@@ -53,83 +54,31 @@
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
-#if PY_VERSION_HEX < 0x02050000
- typedef int Py_ssize_t;
- #define PY_SSIZE_T_MAX INT_MAX
- #define PY_SSIZE_T_MIN INT_MIN
- #define PY_FORMAT_SIZE_T ""
- #define CYTHON_FORMAT_SSIZE_T ""
- #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
- #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
- #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
- (PyErr_Format(PyExc_TypeError, \
- "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
- (PyObject*)0))
- #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
- !PyComplex_Check(o))
- #define PyIndex_Check __Pyx_PyIndex_Check
- #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
- #define __PYX_BUILD_PY_SSIZE_T "i"
-#else
- #define __PYX_BUILD_PY_SSIZE_T "n"
- #define CYTHON_FORMAT_SSIZE_T "z"
- #define __Pyx_PyIndex_Check PyIndex_Check
-#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
- #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
- #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
- #define PyVarObject_HEAD_INIT(type, size) \
- PyObject_HEAD_INIT(type) size,
- #define PyType_Modified(t)
- typedef struct {
- void *buf;
- PyObject *obj;
- Py_ssize_t len;
- Py_ssize_t itemsize;
- int readonly;
- int ndim;
- char *format;
- Py_ssize_t *shape;
- Py_ssize_t *strides;
- Py_ssize_t *suboffsets;
- void *internal;
- } Py_buffer;
- #define PyBUF_SIMPLE 0
- #define PyBUF_WRITABLE 0x0001
- #define PyBUF_FORMAT 0x0004
- #define PyBUF_ND 0x0008
- #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
- #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
- #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
- #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
- #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
- #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
- #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
- typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
- typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
+#define Py_OptimizeFlag 0
#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
- PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+ #define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#endif
-#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
- #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
+ #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
-#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_TPFLAGS_HAVE_VERSION_TAG 0
+#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
@@ -137,13 +86,32 @@
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
- #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
@@ -152,35 +120,12 @@
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PyBytesObject PyStringObject
- #define PyBytes_Type PyString_Type
- #define PyBytes_Check PyString_Check
- #define PyBytes_CheckExact PyString_CheckExact
- #define PyBytes_FromString PyString_FromString
- #define PyBytes_FromStringAndSize PyString_FromStringAndSize
- #define PyBytes_FromFormat PyString_FromFormat
- #define PyBytes_DecodeEscape PyString_DecodeEscape
- #define PyBytes_AsString PyString_AsString
- #define PyBytes_AsStringAndSize PyString_AsStringAndSize
- #define PyBytes_Size PyString_Size
- #define PyBytes_AS_STRING PyString_AS_STRING
- #define PyBytes_GET_SIZE PyString_GET_SIZE
- #define PyBytes_Repr PyString_Repr
- #define PyBytes_Concat PyString_Concat
- #define PyBytes_ConcatAndDel PyString_ConcatAndDel
-#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
- #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
- PyString_Check(obj) || PyUnicode_Check(obj))
- #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
-#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
- #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
@@ -201,11 +146,12 @@
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
-#if PY_VERSION_HEX < 0x03020000
+#if PY_VERSION_HEX < 0x030200A4
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
@@ -213,43 +159,9 @@
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
-#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
- #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
- #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
-#else
- #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
- #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
-#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
-#else
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
-#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_NAMESTR(n) ((char *)(n))
- #define __Pyx_DOCSTR(n) ((char *)(n))
-#else
- #define __Pyx_NAMESTR(n) (n)
- #define __Pyx_DOCSTR(n) (n)
-#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
@@ -264,7 +176,7 @@
#ifndef CYTHON_RESTRICT
#if defined(__GNUC__)
#define CYTHON_RESTRICT __restrict__
- #elif defined(_MSC_VER)
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
#define CYTHON_RESTRICT __restrict
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_RESTRICT restrict
@@ -284,6 +196,12 @@ static CYTHON_INLINE float __PYX_NAN() {
return value;
}
#endif
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+#endif
#if PY_MAJOR_VERSION >= 3
@@ -369,18 +287,30 @@ static CYTHON_INLINE float __PYX_NAN() {
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
- const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
+ (sizeof(type) < sizeof(Py_ssize_t)) || \
+ (sizeof(type) > sizeof(Py_ssize_t) && \
+ likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX) && \
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
+ v == (type)PY_SSIZE_T_MIN))) || \
+ (sizeof(type) == sizeof(Py_ssize_t) && \
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
+ v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
@@ -388,17 +318,19 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
+#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
-#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
-#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
-#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
const Py_UNICODE *u_end = u;
while (*u_end++) ;
- return u_end - u - 1;
+ return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
@@ -412,7 +344,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
-static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
@@ -421,19 +352,22 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
-static int __Pyx_init_sys_getdefaultencoding_params() {
- PyObject* sys = NULL;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
- if (default_encoding == NULL) goto bad;
- if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
- const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
@@ -441,23 +375,21 @@ static int __Pyx_init_sys_getdefaultencoding_params() {
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
- if (ascii_chars_u == NULL) goto bad;
+ if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
- if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
- "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
}
- Py_XDECREF(sys);
- Py_XDECREF(default_encoding);
- Py_XDECREF(ascii_chars_u);
- Py_XDECREF(ascii_chars_b);
+ Py_DECREF(default_encoding);
return 0;
bad:
- Py_XDECREF(sys);
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
@@ -470,22 +402,23 @@ bad:
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
-static int __Pyx_init_sys_getdefaultencoding_params() {
- PyObject* sys = NULL;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
- if (default_encoding == NULL) goto bad;
- default_encoding_c = PyBytes_AS_STRING(default_encoding);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
- Py_DECREF(sys);
Py_DECREF(default_encoding);
return 0;
bad:
- Py_XDECREF(sys);
Py_XDECREF(default_encoding);
return -1;
}
@@ -493,16 +426,11 @@ bad:
#endif
-#ifdef __GNUC__
- /* Test for GCC > 2.95 */
- #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else /* __GNUC__ > 2 ... */
- #define likely(x) (x)
- #define unlikely(x) (x)
- #endif /* __GNUC__ > 2 ... */
-#else /* __GNUC__ */
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
@@ -519,69 +447,71 @@ static const char *__pyx_filename;
static const char *__pyx_f[] = {
- "_cdec.pyx",
- "vectors.pxi",
- "grammar.pxi",
- "hypergraph.pxi",
- "lattice.pxi",
- "mteval.pxi",
- "_sa.pxd",
+ "cdec/_cdec.pyx",
+ "cdec/vectors.pxi",
+ "cdec/grammar.pxi",
+ "cdec/hypergraph.pxi",
+ "cdec/lattice.pxi",
+ "cdec/mteval.pxi",
+ "stringsource",
+ "cdec/sa/_sa.pxd",
};
/*--- Type declarations ---*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__;
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList;
+struct __pyx_obj_4cdec_2sa_3_sa_IntList;
struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector;
+struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
+struct __pyx_obj_4cdec_2sa_3_sa_Rule;
struct __pyx_obj_4cdec_5_cdec_DenseVector;
-struct __pyx_obj_4cdec_5_cdec_SufficientStats;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines;
-struct __pyx_obj_4cdec_5_cdec_TRule;
-struct __pyx_obj_4cdec_5_cdec_MRule;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__;
-struct __pyx_obj_4cdec_5_cdec_Metric;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
-struct __pyx_obj_4cdec_2sa_3_sa_IntList;
struct __pyx_obj_4cdec_5_cdec_SparseVector;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config;
struct __pyx_obj_4cdec_5_cdec_NT;
-struct __pyx_obj_4cdec_5_cdec_Lattice;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
-struct __pyx_obj_4cdec_5_cdec_HypergraphEdge;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase;
-struct __pyx_obj_4cdec_2sa_3_sa_Rule;
-struct __pyx_obj_4cdec_5_cdec_Scorer;
-struct __pyx_obj_4cdec_5_cdec_HypergraphNode;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
struct __pyx_obj_4cdec_5_cdec_NTRef;
+struct __pyx_obj_4cdec_5_cdec_TRule;
+struct __pyx_obj_4cdec_5_cdec_MRule;
struct __pyx_obj_4cdec_5_cdec_Grammar;
+struct __pyx_obj_4cdec_5_cdec_TextGrammar;
struct __pyx_obj_4cdec_5_cdec_Hypergraph;
+struct __pyx_obj_4cdec_5_cdec_HypergraphEdge;
+struct __pyx_obj_4cdec_5_cdec_HypergraphNode;
+struct __pyx_obj_4cdec_5_cdec_Lattice;
+struct __pyx_obj_4cdec_5_cdec_Candidate;
+struct __pyx_obj_4cdec_5_cdec_SufficientStats;
struct __pyx_obj_4cdec_5_cdec_CandidateSet;
-struct __pyx_obj_4cdec_2sa_3_sa_FloatList;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__;
struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
+struct __pyx_obj_4cdec_5_cdec_Scorer;
+struct __pyx_obj_4cdec_5_cdec_Metric;
+struct __pyx_obj_4cdec_5_cdec_Decoder;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest;
-struct __pyx_obj_4cdec_2sa_3_sa_Phrase;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__;
-struct __pyx_obj_4cdec_5_cdec_TextGrammar;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__;
-struct __pyx_obj_4cdec_5_cdec_Decoder;
-struct __pyx_obj_4cdec_5_cdec_Candidate;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__;
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr;
struct __pyx_opt_args_4cdec_5_cdec_as_str;
/* "cdec/_cdec.pyx":6
@@ -596,20 +526,37 @@ struct __pyx_opt_args_4cdec_5_cdec_as_str {
char *error_msg;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":44
- * return self.stats.size()
+/* "cdec/sa/_sa.pxd":3
+ * from libc.stdio cimport FILE
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self[i]
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ {
+struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
PyObject_HEAD
- PyObject *__pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ float *arr;
+};
+
+
+/* "cdec/sa/_sa.pxd":12
+ * cdef void read_handle(self, FILE* f)
+ *
+ * cdef class IntList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_IntList {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab;
+ int size;
+ int increment;
+ int len;
+ int *arr;
};
@@ -627,7 +574,42 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":3
+/* "cdec/sa/_sa.pxd":29
+ * cdef FloatList values
+ *
+ * cdef class Phrase: # <<<<<<<<<<<<<<
+ * cdef int *syms
+ * cdef int n,
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab;
+ int *syms;
+ int n;
+ int *varpos;
+ PyObject *n_vars;
+};
+
+
+/* "cdec/sa/_sa.pxd":37
+ * cdef public int chunklen(self, int k)
+ *
+ * cdef class Rule: # <<<<<<<<<<<<<<
+ * cdef int lhs
+ * cdef readonly Phrase f, e
+ */
+struct __pyx_obj_4cdec_2sa_3_sa_Rule {
+ PyObject_HEAD
+ int lhs;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e;
+ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *scores;
+ int n_scores;
+ PyObject *word_alignments;
+};
+
+
+/* "cdec/vectors.pxi":3
* from cython.operator cimport preincrement as pinc
*
* cdef class DenseVector: # <<<<<<<<<<<<<<
@@ -636,49 +618,52 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
*/
struct __pyx_obj_4cdec_5_cdec_DenseVector {
PyObject_HEAD
- std::vector<weight_t> *vector;
+ std::vector<weight_t> *vector;
int owned;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":26
- * return fmap
+/* "cdec/vectors.pxi":48
+ * return sparse
+ *
+ * cdef class SparseVector: # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t]* vector
*
- * cdef class SufficientStats: # <<<<<<<<<<<<<<
- * cdef mteval.SufficientStats* stats
- * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_SufficientStats {
+struct __pyx_obj_4cdec_5_cdec_SparseVector {
PyObject_HEAD
- SufficientStats *stats;
- EvaluationMetric *metric;
+ FastSparseVector<weight_t> *vector;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
- * def todot(self):
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines(): # <<<<<<<<<<<<<<
- * yield 'digraph lattice {'
- * yield 'rankdir = LR;'
+/* "cdec/grammar.pxi":8
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ * cdef class NT: # <<<<<<<<<<<<<<
+ * cdef public bytes cat
+ * cdef public unsigned ref
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines {
+struct __pyx_obj_4cdec_5_cdec_NT {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_outer_scope;
- PyObject *__pyx_v_delta;
- PyObject *__pyx_v_i;
- PyObject *__pyx_v_label;
- PyObject *__pyx_v_weight;
- Py_ssize_t __pyx_t_0;
- PyObject *__pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
- PyObject *__pyx_t_3;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ PyObject *cat;
+ unsigned int ref;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":49
+/* "cdec/grammar.pxi":21
+ * return '[%s]' % self.cat
+ *
+ * cdef class NTRef: # <<<<<<<<<<<<<<
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref):
+ */
+struct __pyx_obj_4cdec_5_cdec_NTRef {
+ PyObject_HEAD
+ unsigned int ref;
+};
+
+
+/* "cdec/grammar.pxi":49
* return TRule(lhs, f, e, scores, a)
*
* cdef class TRule: # <<<<<<<<<<<<<<
@@ -687,11 +672,11 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines {
*/
struct __pyx_obj_4cdec_5_cdec_TRule {
PyObject_HEAD
- boost::shared_ptr<TRule> *rule;
+ boost::shared_ptr<TRule> *rule;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":183
+/* "cdec/grammar.pxi":183
* _phrase(self.f), _phrase(self.e), scores)
*
* cdef class MRule(TRule): # <<<<<<<<<<<<<<
@@ -703,348 +688,337 @@ struct __pyx_obj_4cdec_5_cdec_MRule {
};
-/* "cdec/_cdec.pyx":47
- * cdef DenseVector weights
+/* "cdec/grammar.pxi":199
+ * super(MRule, self).__init__(lhs, rhs, e, scores, None)
+ *
+ * cdef class Grammar: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[grammar.Grammar]* grammar
*
- * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
- * """Decoder('formalism = scfg') -> initialize from configuration string
- * Decoder(formalism='scfg') -> initialize from named parameters
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ {
+struct __pyx_obj_4cdec_5_cdec_Grammar {
PyObject_HEAD
- PyObject *__pyx_v_config;
+ boost::shared_ptr<Grammar> *grammar;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":56
- * return unicode(str(self), 'utf8')
+/* "cdec/grammar.pxi":223
+ * self.grammar.get().SetGrammarName(name)
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
+ * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
+ * def __init__(self, rules):
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ {
- PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
- Py_ssize_t __pyx_t_0;
- unsigned int __pyx_t_1;
+struct __pyx_obj_4cdec_5_cdec_TextGrammar {
+ struct __pyx_obj_4cdec_5_cdec_Grammar __pyx_base;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":176
- * out.fields[i] = ss[i]
+/* "cdec/hypergraph.pxi":4
+ * cimport kbest
*
- * cdef class Metric: # <<<<<<<<<<<<<<
- * cdef Scorer scorer
- * def __cinit__(self):
+ * cdef class Hypergraph: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef MT19937* rng
*/
-struct __pyx_obj_4cdec_5_cdec_Metric {
+struct __pyx_obj_4cdec_5_cdec_Hypergraph {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_Scorer *scorer;
+ struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtab;
+ Hypergraph *hg;
+ MT19937 *rng;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":97
- * del derivations
+/* "cdec/hypergraph.pxi":259
+ * return vector
*
- * def unique_kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest {
+struct __pyx_obj_4cdec_5_cdec_HypergraphEdge {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique>::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique> *__pyx_v_derivations;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtab;
+ Hypergraph *hg;
+ Hypergraph::Edge *edge;
+ struct __pyx_obj_4cdec_5_cdec_TRule *trule;
};
-/* "cdec/sa/_sa.pxd":12
- * cdef void read_handle(self, FILE* f)
+/* "cdec/hypergraph.pxi":309
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
*
- * cdef class IntList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
*/
-struct __pyx_obj_4cdec_2sa_3_sa_IntList {
+struct __pyx_obj_4cdec_5_cdec_HypergraphNode {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab;
- int size;
- int increment;
- int len;
- int *arr;
+ struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtab;
+ Hypergraph *hg;
+ Hypergraph::Node *node;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":48
- * return sparse
+/* "cdec/lattice.pxi":3
+ * cimport lattice
*
- * cdef class SparseVector: # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t]* vector
+ * cdef class Lattice: # <<<<<<<<<<<<<<
+ * cdef lattice.Lattice* lattice
*
*/
-struct __pyx_obj_4cdec_5_cdec_SparseVector {
+struct __pyx_obj_4cdec_5_cdec_Lattice {
PyObject_HEAD
- FastSparseVector<weight_t> *vector;
+ Lattice *lattice;
};
-/* "cdec/_cdec.pyx":32
- * SetSilent(yn)
+/* "cdec/mteval.pxi":12
+ * return stats
*
- * def _make_config(config): # <<<<<<<<<<<<<<
- * for key, value in config.items():
- * if isinstance(value, dict):
+ * cdef class Candidate: # <<<<<<<<<<<<<<
+ * cdef mteval.const_Candidate* candidate
+ * cdef public float score
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config {
+struct __pyx_obj_4cdec_5_cdec_Candidate {
PyObject_HEAD
- PyObject *__pyx_v_config;
- PyObject *__pyx_v_info;
- PyObject *__pyx_v_key;
- PyObject *__pyx_v_name;
- PyObject *__pyx_v_value;
- PyObject *__pyx_t_0;
- PyObject *__pyx_t_1;
- Py_ssize_t __pyx_t_2;
- PyObject *(*__pyx_t_3)(PyObject *);
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ const training::Candidate *candidate;
+ float score;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":8
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+/* "cdec/mteval.pxi":26
+ * return fmap
*
- * cdef class NT: # <<<<<<<<<<<<<<
- * cdef public bytes cat
- * cdef public unsigned ref
+ * cdef class SufficientStats: # <<<<<<<<<<<<<<
+ * cdef mteval.SufficientStats* stats
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_NT {
+struct __pyx_obj_4cdec_5_cdec_SufficientStats {
PyObject_HEAD
- PyObject *cat;
- unsigned int ref;
+ SufficientStats *stats;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":3
- * cimport lattice
- *
- * cdef class Lattice: # <<<<<<<<<<<<<<
- * cdef lattice.Lattice* lattice
+/* "cdec/mteval.pxi":68
+ * return result
*
+ * cdef class CandidateSet: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_Lattice {
+struct __pyx_obj_4cdec_5_cdec_CandidateSet {
PyObject_HEAD
- Lattice *lattice;
+ boost::shared_ptr<SegmentEvaluator> *scorer;
+ EvaluationMetric *metric;
+ training::CandidateSet *cs;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":156
- * del hypos
+/* "cdec/mteval.pxi":103
+ * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
*
- * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
- * cdef vector[string]* trees = new vector[string]()
+ * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
+ * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees {
+struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator {
PyObject_HEAD
- unsigned int __pyx_v_k;
- unsigned int __pyx_v_n;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- std::vector<std::string> *__pyx_v_trees;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ boost::shared_ptr<SegmentEvaluator> *scorer;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":244
- * return vector
+/* "cdec/mteval.pxi":124
+ * return CandidateSet(self)
*
- * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
+ * cdef class Scorer: # <<<<<<<<<<<<<<
+ * cdef string* name
+ * cdef mteval.EvaluationMetric* metric
*/
-struct __pyx_obj_4cdec_5_cdec_HypergraphEdge {
+struct __pyx_obj_4cdec_5_cdec_Scorer {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtab;
- Hypergraph *hg;
- Hypergraph::Edge *edge;
- struct __pyx_obj_4cdec_5_cdec_TRule *trule;
+ std::string *name;
+ EvaluationMetric *metric;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
- * import cdec.sa._sa as _sa
- *
- * def _phrase(phrase): # <<<<<<<<<<<<<<
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+/* "cdec/mteval.pxi":179
+ * out.fields[i] = ss[i]
*
+ * cdef class Metric: # <<<<<<<<<<<<<<
+ * cdef Scorer scorer
+ * def __cinit__(self):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase {
+struct __pyx_obj_4cdec_5_cdec_Metric {
PyObject_HEAD
- PyObject *__pyx_v_phrase;
+ struct __pyx_obj_4cdec_5_cdec_Scorer *scorer;
};
-/* "cdec/sa/_sa.pxd":35
- * cdef public int chunklen(self, int k)
+/* "cdec/_cdec.pyx":43
+ * yield key, str(value)
*
- * cdef class Rule: # <<<<<<<<<<<<<<
- * cdef int lhs
- * cdef readonly Phrase f, e
+ * cdef class Decoder: # <<<<<<<<<<<<<<
+ * cdef decoder.Decoder* dec
+ * cdef DenseVector weights
*/
-struct __pyx_obj_4cdec_2sa_3_sa_Rule {
+struct __pyx_obj_4cdec_5_cdec_Decoder {
PyObject_HEAD
- int lhs;
- struct __pyx_obj_4cdec_2sa_3_sa_Phrase *f;
- struct __pyx_obj_4cdec_2sa_3_sa_Phrase *e;
- struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *scores;
- int n_scores;
- PyObject *word_alignments;
+ Decoder *dec;
+ struct __pyx_obj_4cdec_5_cdec_DenseVector *weights;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":121
- * return CandidateSet(self)
+/* "cdec/vectors.pxi":32
+ * self.vector[0][fid] = value
*
- * cdef class Scorer: # <<<<<<<<<<<<<<
- * cdef string* name
- * cdef mteval.EvaluationMetric* metric
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
*/
-struct __pyx_obj_4cdec_5_cdec_Scorer {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ {
PyObject_HEAD
- std::string *name;
- EvaluationMetric *metric;
+ unsigned int __pyx_v_fid;
+ struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":294
- * raise NotImplemented('comparison not implemented for HypergraphEdge')
+/* "cdec/vectors.pxi":72
+ * self.vector.set_value(fid, value)
*
- * cdef class HypergraphNode: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphNode* node
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
*/
-struct __pyx_obj_4cdec_5_cdec_HypergraphNode {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtab;
- Hypergraph *hg;
- Hypergraph::Node *node;
+ unsigned int __pyx_v_i;
+ FastSparseVector<weight_t> ::const_iterator *__pyx_v_it;
+ struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":81
- * del e_derivations
+/* "cdec/grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
- * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase {
PyObject_HEAD
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
- struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ PyObject *__pyx_v_phrase;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":21
- * return '[%s]' % self.cat
+/* "cdec/grammar.pxi":6
*
- * cdef class NTRef: # <<<<<<<<<<<<<<
- * cdef public unsigned ref
- * def __init__(self, unsigned ref):
+ * def _phrase(phrase):
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
+ *
+ * cdef class NT:
*/
-struct __pyx_obj_4cdec_5_cdec_NTRef {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr {
PyObject_HEAD
- unsigned int ref;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_outer_scope;
+ PyObject *__pyx_v_w;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":199
- * super(MRule, self).__init__(lhs, rhs, e, scores, None)
- *
- * cdef class Grammar: # <<<<<<<<<<<<<<
- * cdef shared_ptr[grammar.Grammar]* grammar
+/* "cdec/grammar.pxi":137
*
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
*/
-struct __pyx_obj_4cdec_5_cdec_Grammar {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ {
PyObject_HEAD
- boost::shared_ptr<Grammar> *grammar;
+ std::vector<AlignmentPoint> *__pyx_v_a;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":4
- * cimport kbest
+/* "cdec/grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
- * cdef class Hypergraph: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef MT19937* rng
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
*/
-struct __pyx_obj_4cdec_5_cdec_Hypergraph {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtab;
- Hypergraph *hg;
- MT19937 *rng;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":65
- * return result
+/* "cdec/grammar.pxi":179
*
- * cdef class CandidateSet: # <<<<<<<<<<<<<<
- * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
- * cdef mteval.EvaluationMetric* metric
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
+ * _phrase(self.f), _phrase(self.e), scores)
*/
-struct __pyx_obj_4cdec_5_cdec_CandidateSet {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr {
PyObject_HEAD
- boost::shared_ptr<SegmentEvaluator> *scorer;
- EvaluationMetric *metric;
- training::CandidateSet *cs;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_outer_scope;
+ PyObject *__pyx_v_feat;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "cdec/sa/_sa.pxd":3
- * from libc.stdio cimport FILE
+/* "cdec/grammar.pxi":205
+ * del self.grammar
*
- * cdef class FloatList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
*/
-struct __pyx_obj_4cdec_2sa_3_sa_FloatList {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab;
- int size;
- int increment;
- int len;
- float *arr;
+ unsigned int __pyx_v_i;
+ const RuleBin *__pyx_v_rbin;
+ const GrammarIter *__pyx_v_root;
+ struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self;
+ struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_trule;
+ int __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":61
- * yield self[i]
+/* "cdec/hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
*
- * def todot(self): # <<<<<<<<<<<<<<
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines():
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_derivations;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":62
+/* "cdec/hypergraph.pxi":62
* del derivations
*
* def kbest_trees(self, size): # <<<<<<<<<<<<<<
@@ -1053,11 +1027,11 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot {
*/
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_e_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_e_derivations;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_e_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_e_derivations;
PyObject *__pyx_v_e_tree;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_f_derivation;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_f_derivations;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::NoFilter<std::vector<int> > > ::Derivation *__pyx_v_f_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_f_derivations;
PyObject *__pyx_v_f_tree;
unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
@@ -1067,66 +1041,69 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":178
- * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * scores = ' '.join('%s=%s' % feat for feat in self.scores)
- * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
- */
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ {
- PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":100
- * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get())
+/* "cdec/hypergraph.pxi":81
+ * del e_derivations
*
- * cdef class SegmentEvaluator: # <<<<<<<<<<<<<<
- * cdef shared_ptr[mteval.SegmentEvaluator]* scorer
- * cdef mteval.EvaluationMetric* metric
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features {
PyObject_HEAD
- boost::shared_ptr<SegmentEvaluator> *scorer;
- EvaluationMetric *metric;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
+ struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":209
+/* "cdec/hypergraph.pxi":97
+ * del derivations
*
- * property edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.edges_.size()):
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest {
PyObject_HEAD
- unsigned int __pyx_v_i;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> *__pyx_v_derivations;
+ unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":314
+/* "cdec/hypergraph.pxi":110
+ * del derivations
*
- * property out_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.out_edges_.size()):
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees {
PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_e_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> *__pyx_v_e_derivations;
+ PyObject *__pyx_v_e_tree;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> ::Derivation *__pyx_v_f_derivation;
+ KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> *__pyx_v_f_derivations;
+ PyObject *__pyx_v_f_tree;
+ unsigned int __pyx_v_k;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ PyObject *__pyx_v_size;
+ unsigned int __pyx_t_0;
+ long __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":129
+/* "cdec/hypergraph.pxi":129
* del e_derivations
*
* def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
@@ -1135,8 +1112,8 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
*/
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features {
PyObject_HEAD
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ::Derivation *__pyx_v_derivation;
+ KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > *__pyx_v_derivations;
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
unsigned int __pyx_v_k;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
@@ -1146,119 +1123,117 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features {
};
-/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
- * raise InvalidConfig('formalism "%s" unknown' % formalism)
- * config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
- * cdef istringstream* config_stream = new istringstream(config_str)
- * self.dec = new decoder.Decoder(config_stream)
+/* "cdec/hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_outer_scope;
- PyObject *__pyx_v_kv;
- PyObject *__pyx_t_0;
- Py_ssize_t __pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
+ unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
- *
- * def _phrase(phrase):
- * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
+/* "cdec/hypergraph.pxi":156
+ * del hypos
*
- * cdef class NT:
+ * def sample_hypotheses(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.
+ * Generates (sample_string, dot, fmap)"""
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_outer_scope;
- PyObject *__pyx_v_w;
- PyObject *__pyx_t_0;
- Py_ssize_t __pyx_t_1;
- PyObject *(*__pyx_t_2)(PyObject *);
+ struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap;
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
+ unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":49
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+/* "cdec/hypergraph.pxi":171
+ * del hypos
*
- * def kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
+ * cdef vector[string]* trees = new vector[string]()
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees {
PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::NoFilter<std::vector<int> > >::Derivation *__pyx_v_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::NoFilter<std::vector<int> > > *__pyx_v_derivations;
unsigned int __pyx_v_k;
+ unsigned int __pyx_v_n;
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
+ std::vector<std::string> *__pyx_v_trees;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "cdec/sa/_sa.pxd":29
- * cdef FloatList values
+/* "cdec/hypergraph.pxi":224
*
- * cdef class Phrase: # <<<<<<<<<<<<<<
- * cdef int *syms
- * cdef int n, *varpos, n_vars
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
*/
-struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ {
PyObject_HEAD
- struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab;
- int *syms;
- int n;
- int *varpos;
- int n_vars;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":264
+/* "cdec/hypergraph.pxi":230
*
- * property tail_nodes:
+ * property nodes:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
- * for i in range(self.edge.tail_nodes_.size()):
+ * for i in range(self.hg.nodes_.size()):
*/
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self;
- unsigned int __pyx_t_0;
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
+ size_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":205
- * del self.grammar
+/* "cdec/hypergraph.pxi":279
*
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
- * cdef grammar.const_RuleBin* rbin = root.GetRules()
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- const RuleBin *__pyx_v_rbin;
- const GrammarIter *__pyx_v_root;
- struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self;
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_trule;
- int __pyx_t_0;
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self;
+ unsigned int __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":308
+/* "cdec/hypergraph.pxi":323
*
* property in_edges:
* def __get__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(self.node.in_edges_.size()):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ {
PyObject_HEAD
unsigned int __pyx_v_i;
struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self;
@@ -1267,213 +1242,174 @@ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ {
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":223
- * self.grammar.get().SetGrammarName(name)
+/* "cdec/hypergraph.pxi":329
*
- * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<<
- * def __init__(self, rules):
- * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
*/
-struct __pyx_obj_4cdec_5_cdec_TextGrammar {
- struct __pyx_obj_4cdec_5_cdec_Grammar __pyx_base;
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ {
+ PyObject_HEAD
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self;
+ size_t __pyx_t_0;
+ unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":90
- * return candidate
+/* "cdec/lattice.pxi":56
+ * return unicode(str(self), 'utf8')
*
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(len(self)):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ {
PyObject_HEAD
unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self;
+ struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
Py_ssize_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "cdec/_cdec.pyx":43
- * yield key, str(value)
- *
- * cdef class Decoder: # <<<<<<<<<<<<<<
- * cdef decoder.Decoder* dec
- * cdef DenseVector weights
- */
-struct __pyx_obj_4cdec_5_cdec_Decoder {
- PyObject_HEAD
- Decoder *dec;
- struct __pyx_obj_4cdec_5_cdec_DenseVector *weights;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":12
- * return stats
+/* "cdec/lattice.pxi":61
+ * yield self[i]
*
- * cdef class Candidate: # <<<<<<<<<<<<<<
- * cdef mteval.const_Candidate* candidate
- * cdef public float score
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
*/
-struct __pyx_obj_4cdec_5_cdec_Candidate {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot {
PyObject_HEAD
- const training::Candidate *candidate;
- float score;
+ struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":145
- * del derivations
- *
- * def sample(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+/* "cdec/lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines {
PyObject_HEAD
- std::vector<HypergraphSampler::Hypothesis> *__pyx_v_hypos;
- unsigned int __pyx_v_k;
- unsigned int __pyx_v_n;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *__pyx_outer_scope;
+ PyObject *__pyx_v_delta;
+ PyObject *__pyx_v_i;
+ PyObject *__pyx_v_label;
+ PyObject *__pyx_v_weight;
+ Py_ssize_t __pyx_t_0;
+ PyObject *__pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":215
+/* "cdec/mteval.pxi":47
+ * return self.stats.size()
*
- * property nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.nodes_.size()):
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ {
PyObject_HEAD
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ Py_ssize_t __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
+ Py_ssize_t __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":32
- * self.vector[0][fid] = value
+/* "cdec/mteval.pxi":93
+ * return candidate
*
* def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned fid
- * for fid in range(1, self.vector.size()):
+ * cdef unsigned i
+ * for i in range(len(self)):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ {
PyObject_HEAD
- unsigned int __pyx_v_fid;
- struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self;
- size_t __pyx_t_0;
+ unsigned int __pyx_v_i;
+ struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self;
+ Py_ssize_t __pyx_t_0;
unsigned int __pyx_t_1;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+/* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
*
- * def __str__(self):
- * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
- * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
- * _phrase(self.f), _phrase(self.e), scores)
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config {
PyObject_HEAD
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_outer_scope;
- PyObject *__pyx_v_feat;
+ PyObject *__pyx_v_config;
+ PyObject *__pyx_v_info;
+ PyObject *__pyx_v_key;
+ PyObject *__pyx_v_name;
+ PyObject *__pyx_v_value;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
PyObject *(*__pyx_t_2)(PyObject *);
+ PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":110
- * del derivations
- *
- * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees {
- PyObject_HEAD
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique>::Derivation *__pyx_v_e_derivation;
- KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique> *__pyx_v_e_derivations;
- PyObject *__pyx_v_e_tree;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique>::Derivation *__pyx_v_f_derivation;
- KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique> *__pyx_v_f_derivations;
- PyObject *__pyx_v_f_tree;
- unsigned int __pyx_v_k;
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self;
- PyObject *__pyx_v_size;
- unsigned int __pyx_t_0;
- long __pyx_t_1;
-};
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":137
+/* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
*
- * property a:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ {
PyObject_HEAD
- std::vector<AlignmentPoint> *__pyx_v_a;
- unsigned int __pyx_v_i;
- struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ PyObject *__pyx_v_config;
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":72
- * self.vector.set_value(fid, value)
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
- * cdef unsigned i
+/* "cdec/_cdec.pyx":56
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
+ * raise InvalidConfig('formalism "%s" unknown' % formalism)
+ * config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
+ * cdef istringstream* config_stream = new istringstream(config_str)
+ * self.dec = new decoder.Decoder(config_stream)
*/
-struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ {
+struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr {
PyObject_HEAD
- unsigned int __pyx_v_i;
- FastSparseVector<weight_t>::const_iterator *__pyx_v_it;
- struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self;
- size_t __pyx_t_0;
- unsigned int __pyx_t_1;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *__pyx_outer_scope;
+ PyObject *__pyx_v_kv;
+ PyObject *__pyx_t_0;
+ Py_ssize_t __pyx_t_1;
+ PyObject *(*__pyx_t_2)(PyObject *);
};
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":294
- * raise NotImplemented('comparison not implemented for HypergraphEdge')
- *
- * cdef class HypergraphNode: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphNode* node
- */
-
-struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode {
- PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
-};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
-
-
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":244
- * return vector
+/* "cdec/sa/_sa.pxd":3
+ * from libc.stdio cimport FILE
*
- * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
+ * cdef class FloatList: # <<<<<<<<<<<<<<
+ * cdef int size
+ * cdef int increment
*/
-struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge {
- PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
+ void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float);
+ void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
+ void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
/* "cdec/sa/_sa.pxd":12
@@ -1496,28 +1432,12 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList;
-/* "cdec/sa/_sa.pxd":3
- * from libc.stdio cimport FILE
- *
- * cdef class FloatList: # <<<<<<<<<<<<<<
- * cdef int size
- * cdef int increment
- */
-
-struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList {
- void (*set)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float);
- void (*write_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
- void (*read_handle)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *);
-};
-static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList;
-
-
/* "cdec/sa/_sa.pxd":29
* cdef FloatList values
*
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
- * cdef int n, *varpos, n_vars
+ * cdef int n,
*/
struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase {
@@ -1527,7 +1447,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;
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":4
+/* "cdec/hypergraph.pxi":4
* cimport kbest
*
* cdef class Hypergraph: # <<<<<<<<<<<<<<
@@ -1539,6 +1459,34 @@ struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph {
MT19937 *(*_rng)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *);
};
static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cdec_Hypergraph;
+
+
+/* "cdec/hypergraph.pxi":259
+ * return vector
+ *
+ * cdef class HypergraphEdge: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ */
+
+struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge {
+ PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+
+
+/* "cdec/hypergraph.pxi":309
+ * raise NotImplemented('comparison not implemented for HypergraphEdge')
+ *
+ * cdef class HypergraphNode: # <<<<<<<<<<<<<<
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphNode* node
+ */
+
+struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode {
+ PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int);
+};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
@@ -1552,7 +1500,7 @@ static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cd
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
- static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
@@ -1589,7 +1537,15 @@ static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cd
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
-#endif /* CYTHON_REFNANNY */
+#endif
+#define __Pyx_XDECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_XDECREF(tmp); \
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do { \
+ PyObject *tmp = (PyObject *) r; \
+ r = v; __Pyx_DECREF(tmp); \
+ } while (0)
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
@@ -1608,30 +1564,66 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
-static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
- Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
+
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+ const char *name, int exact);
-static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
- const char *name, int exact); /*proto*/
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyString_Join __Pyx_PyBytes_Join
+#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
+#else
+#define __Pyx_PyString_Join PyUnicode_Join
+#define __Pyx_PyBaseString_Join PyUnicode_Join
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ #if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyBytes_Join _PyString_Join
+ #else
+ #define __Pyx_PyBytes_Join _PyBytes_Join
+ #endif
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
+#endif
+
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
- const char* function_name); /*proto*/
+ const char* function_name);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
@@ -1650,6 +1642,12 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
#endif
#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
PyTypeObject* tp = Py_TYPE(obj);
@@ -1666,42 +1664,25 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif
-static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
- PyObject *method, *result = NULL;
- if (unlikely(!args)) return NULL;
- method = __Pyx_PyObject_GetAttrStr(obj, method_name);
- if (unlikely(!method)) goto bad;
- result = PyObject_Call(method, args, NULL);
- Py_DECREF(method);
-bad:
- Py_DECREF(args);
- return result;
-}
-#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
-#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
-#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
-#define __Pyx_PyObject_CallMethod0(obj, name) \
- __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))
-
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/
-
-#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
- (((size) <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
-#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
- (((size) <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
+
+static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
+
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
-#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
- (((size) <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
@@ -1712,14 +1693,15 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+static CYTHON_INLINE int __Pyx_IterFinish(void);
-static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
-static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
static void __Pyx_WriteUnraisable(const char *name, int clineno,
- int lineno, const char *filename); /*proto*/
+ int lineno, const char *filename,
+ int full_traceback);
static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
int result = PyDict_Contains(dict, item);
@@ -1727,7 +1709,9 @@ static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, i
}
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
-static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
+
+static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
@@ -1744,28 +1728,32 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*pro
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
- int flags;
- PyObject *func_dict;
+#if PY_VERSION_HEX < 0x030500A0
PyObject *func_weakreflist;
+#endif
+ PyObject *func_dict;
PyObject *func_name;
PyObject *func_qualname;
PyObject *func_doc;
+ PyObject *func_globals;
PyObject *func_code;
PyObject *func_closure;
- PyObject *func_classobj; /* No-args super() class cell */
+ PyObject *func_classobj;
void *defaults;
int defaults_pyobjects;
- PyObject *defaults_tuple; /* Const defaults tuple */
- PyObject *defaults_kwdict; /* Const kwonly defaults dict */
+ int flags;
+ PyObject *defaults_tuple;
+ PyObject *defaults_kwdict;
PyObject *(*defaults_getter)(PyObject *);
- PyObject *func_annotations; /* function annotations dict */
+ PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
-#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
- __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
+#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
+ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
int flags, PyObject* qualname,
- PyObject *self, PyObject *module,
+ PyObject *self,
+ PyObject *module, PyObject *globals,
PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
size_t size,
@@ -1778,9 +1766,46 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
PyObject *dict);
static int __Pyx_CyFunction_init(void);
-static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); /*proto*/
+static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
+
+#include <string.h>
+
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
-static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
+static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
+ PyObject *res;
+ PyTypeObject *tp = Py_TYPE(obj);
+#if PY_MAJOR_VERSION < 3
+ if (unlikely(PyInstance_Check(obj)))
+ return __Pyx_PyObject_GetAttrStr(obj, attr_name);
+#endif
+ res = _PyType_Lookup(tp, attr_name);
+ if (likely(res)) {
+ descrgetfunc f = Py_TYPE(res)->tp_descr_get;
+ if (!f) {
+ Py_INCREF(res);
+ } else {
+ res = f(res, obj, (PyObject *)tp);
+ }
+ } else {
+ PyErr_SetObject(PyExc_AttributeError, attr_name);
+ }
+ return res;
+}
+#else
+#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
+#endif
+
+static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj) \
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
@@ -1792,23 +1817,41 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
-#include <string.h>
+static void* __Pyx_GetVtable(PyObject *dict);
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
-static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
+static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
+ PyObject *mkw, PyObject *modname, PyObject *doc);
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
+ PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
- PyObject *qualname, PyObject *modname); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
#ifndef __Pyx_CppExn2PyErr
#include <new>
@@ -1849,43 +1892,19 @@ static void __Pyx_CppExn2PyErr() {
}
#endif
-static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject *);
-
-static PyObject* __Pyx_Globals(void); /*proto*/
-
-static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
-
-static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
-
-static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
-
-static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
-static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
-static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
+static CYTHON_INLINE WordID __Pyx_PyInt_As_WordID(PyObject *);
-static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
-static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
-static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+static PyObject* __Pyx_Globals(void);
-static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
-
-static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
-
-static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
-
-static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
-
-static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
-
-static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
-
-static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
-
-static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
#define __Pyx_Generator_USED
#include <structmember.h>
@@ -1901,11 +1920,13 @@ typedef struct {
PyObject *gi_weakreflist;
PyObject *classobj;
PyObject *yieldfrom;
+ PyObject *gi_name;
+ PyObject *gi_qualname;
int resume_label;
- char is_running; // using T_BOOL for property below requires char value
+ char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure);
+ PyObject *closure, PyObject *name, PyObject *qualname);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
@@ -1924,31 +1945,17 @@ static int __Pyx_check_binary_version(void);
#endif
#endif
-static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
+static PyObject *__Pyx_ImportModule(const char *name);
-static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
-static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
+static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
-typedef struct {
- int code_line;
- PyCodeObject* code_object;
-} __Pyx_CodeObjectCacheEntry;
-struct __Pyx_CodeObjectCache {
- int count;
- int max_count;
- __Pyx_CodeObjectCacheEntry* entries;
-};
-static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
-static PyCodeObject *__pyx_find_code_object(int code_line);
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
-
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename); /*proto*/
-
-static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto*/
+static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i); /* proto*/
+static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i); /* proto*/
/* Module declarations from 'libc.string' */
@@ -1988,59 +1995,60 @@ static int (*__pyx_f_4cdec_2sa_3_sa_sym_getindex)(int); /*proto*/
/* Module declarations from 'cdec.mteval' */
/* Module declarations from 'cdec._cdec' */
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TRule = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_MRule = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_DenseVector = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SufficientStats = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Metric = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Candidate = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SparseVector = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_NT = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Lattice = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphEdge = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Scorer = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphNode = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_NTRef = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TRule = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_MRule = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Grammar = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TextGrammar = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Hypergraph = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphEdge = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_HypergraphNode = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Lattice = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Candidate = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SufficientStats = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_CandidateSet = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec_SegmentEvaluator = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Scorer = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Metric = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Decoder = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16_sample_trees = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TextGrammar = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___get__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_todot = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24_lines = 0;
static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Decoder = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27__make_config = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28___init__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_29_genexpr = 0;
static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *, struct __pyx_opt_args_4cdec_5_cdec_as_str *__pyx_optional_args); /*proto*/
static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/
static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/
static float __pyx_f_4cdec_5_cdec__compute_score(void *, SufficientStats *); /*proto*/
-static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/
+static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector<std::string> *, SufficientStats *); /*proto*/
static std::string __pyx_convert_string_from_py_(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "cdec._cdec"
int __pyx_module_is_main_cdec___cdec = 0;
@@ -2066,7 +2074,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_12SparseVector___init__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
-static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */
static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value); /* proto */
@@ -2102,7 +2110,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_a, PyObject *__pyx_v_text); /* proto */
-static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
@@ -2117,7 +2125,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
@@ -2135,17 +2143,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(struct __pyx_
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_hypotheses(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36sample_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_39intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_41prune(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_43lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_45plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_47reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_49inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */
@@ -2165,7 +2174,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
static PyObject *__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); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */
static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */
@@ -2179,25 +2188,26 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
-static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static int __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
+static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator); /* proto */
-static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k); /* proto */
-static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
-static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self); /* proto */
@@ -2208,376 +2218,452 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config); /* proto */
-static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
+static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self); /* proto */
-static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */
+static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_scaling); /* proto */
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar); /* proto */
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static char __pyx_k_1[] = "Cannot convert type %s to str";
-static char __pyx_k_3[] = "cannot take the dot product of %s and SparseVector";
-static char __pyx_k_4[] = "comparison not implemented for SparseVector";
-static char __pyx_k_7[] = " ";
-static char __pyx_k_8[] = "[%s,%d]";
-static char __pyx_k_9[] = "[%s]";
-static char __pyx_k_10[] = "[%d]";
-static char __pyx_k_11[] = "%s=%s";
-static char __pyx_k_12[] = "%s ||| %s ||| %s ||| %s";
-static char __pyx_k_13[] = "the grammar should contain TRule objects";
-static char __pyx_k_15[] = "cannot intersect hypergraph with %s";
-static char __pyx_k_16[] = "csplit_preserve_full_word";
-static char __pyx_k_17[] = "cannot reweight hypergraph with %s";
-static char __pyx_k_18[] = "comparison not implemented for HypergraphEdge";
-static char __pyx_k_20[] = "comparison not implemented for HypergraphNode";
-static char __pyx_k_22[] = "cannot create lattice from %s";
-static char __pyx_k_23[] = "lattice index out of range";
-static char __pyx_k_26[] = "digraph lattice {";
- static char __pyx_k_27[] = "rankdir = LR;";
- static char __pyx_k_28[] = "node [shape=circle];";
- static char __pyx_k_29[] = "%d -> %d [label=\"%s\"];";
- static char __pyx_k_30[] = "\"";
- static char __pyx_k_31[] = "\\\"";
- static char __pyx_k_33[] = "%d [shape=doublecircle]";
-static char __pyx_k_34[] = "}";
-static char __pyx_k_37[] = "/usr0/home/austinma/git/cdec/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";
-static char __pyx_k_42[] = "sufficient stats vector index out of range";
-static char __pyx_k_44[] = "candidate set index out of range";
-static char __pyx_k_46[] = "%s %s";
-static char __pyx_k_47[] = "%s = %s";
-static char __pyx_k_48[] = "formalism \"%s\" unknown";
-static char __pyx_k_49[] = "cannot initialize weights with %s";
-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[] = "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi";
-static char __pyx_k_66[] = "/usr0/home/austinma/git/cdec/python/cdec/_cdec.pyx";
-static char __pyx_k__a[] = "a";
-static char __pyx_k__e[] = "e";
-static char __pyx_k__f[] = "f";
-static char __pyx_k__i[] = "i";
-static char __pyx_k__k[] = "k";
-static char __pyx_k__pb[] = "pb";
-static char __pyx_k__yn[] = "yn";
-static char __pyx_k__CER[] = "CER";
-static char __pyx_k__SSK[] = "SSK";
-static char __pyx_k__TER[] = "TER";
-static char __pyx_k___sa[] = "_sa";
-static char __pyx_k__cat[] = "cat";
-static char __pyx_k__dot[] = "dot";
-static char __pyx_k__fst[] = "fst";
-static char __pyx_k__get[] = "get";
-static char __pyx_k__hyp[] = "hyp";
-static char __pyx_k__inp[] = "inp";
-static char __pyx_k__key[] = "key";
-static char __pyx_k__lhs[] = "lhs";
-static char __pyx_k__plf[] = "plf";
-static char __pyx_k__ref[] = "ref";
-static char __pyx_k__rhs[] = "rhs";
-static char __pyx_k__BLEU[] = "BLEU";
-static char __pyx_k__QCRI[] = "QCRI";
-static char __pyx_k__args[] = "args";
-static char __pyx_k__eval[] = "eval";
-static char __pyx_k__info[] = "info";
-static char __pyx_k__join[] = "join";
-static char __pyx_k__name[] = "name";
-static char __pyx_k__open[] = "open";
-static char __pyx_k__refs[] = "refs";
-static char __pyx_k__scfg[] = "scfg";
-static char __pyx_k__self[] = "self";
-static char __pyx_k__send[] = "send";
-static char __pyx_k__span[] = "span";
-static char __pyx_k__text[] = "text";
-static char __pyx_k__utf8[] = "utf8";
-static char __pyx_k__close[] = "close";
-static char __pyx_k__delta[] = "delta";
-static char __pyx_k__items[] = "items";
-static char __pyx_k__label[] = "label";
-static char __pyx_k__lines[] = "lines";
-static char __pyx_k__range[] = "range";
-static char __pyx_k__rules[] = "rules";
-static char __pyx_k__score[] = "score";
-static char __pyx_k__split[] = "split";
-static char __pyx_k__strip[] = "strip";
-static char __pyx_k__super[] = "super";
-static char __pyx_k__throw[] = "throw";
-static char __pyx_k__value[] = "value";
-static char __pyx_k__append[] = "append";
-static char __pyx_k__config[] = "config";
-static char __pyx_k__csplit[] = "csplit";
-static char __pyx_k__encode[] = "encode";
-static char __pyx_k__format[] = "format";
-static char __pyx_k__phrase[] = "phrase";
-static char __pyx_k__scores[] = "scores";
-static char __pyx_k__tagger[] = "tagger";
-static char __pyx_k__weight[] = "weight";
-static char __pyx_k___phrase[] = "_phrase";
-static char __pyx_k__density[] = "density";
-static char __pyx_k__genexpr[] = "genexpr";
-static char __pyx_k__grammar[] = "grammar";
-static char __pyx_k__replace[] = "replace";
-static char __pyx_k__IBM_BLEU[] = "IBM_BLEU";
-static char __pyx_k__KeyError[] = "KeyError";
-static char __pyx_k____dict__[] = "__dict__";
-static char __pyx_k____exit__[] = "__exit__";
-static char __pyx_k____init__[] = "__init__";
-static char __pyx_k____main__[] = "__main__";
-static char __pyx_k____name__[] = "__name__";
-static char __pyx_k____test__[] = "__test__";
-static char __pyx_k__encoding[] = "encoding";
-static char __pyx_k__evaluate[] = "evaluate";
-static char __pyx_k__in_edges[] = "in_edges";
-static char __pyx_k__lexalign[] = "lexalign";
-static char __pyx_k__lextrans[] = "lextrans";
-static char __pyx_k__sentence[] = "sentence";
-static char __pyx_k__Exception[] = "Exception";
-static char __pyx_k__QCRI_BLEU[] = "QCRI_BLEU";
-static char __pyx_k__TypeError[] = "TypeError";
-static char __pyx_k____class__[] = "__class__";
-static char __pyx_k____enter__[] = "__enter__";
-static char __pyx_k__enumerate[] = "enumerate";
-static char __pyx_k__evaluator[] = "evaluator";
-static char __pyx_k__formalism[] = "formalism";
-static char __pyx_k__IndexError[] = "IndexError";
-static char __pyx_k__ValueError[] = "ValueError";
-static char __pyx_k____import__[] = "__import__";
-static char __pyx_k____module__[] = "__module__";
-static char __pyx_k__alignments[] = "alignments";
-static char __pyx_k__beam_alpha[] = "beam_alpha";
-static char __pyx_k__config_str[] = "config_str";
-static char __pyx_k__hypergraph[] = "hypergraph";
-static char __pyx_k__set_silent[] = "set_silent";
-static char __pyx_k__startswith[] = "startswith";
-static char __pyx_k__ParseFailed[] = "ParseFailed";
-static char __pyx_k____qualname__[] = "__qualname__";
-static char __pyx_k___make_config[] = "_make_config";
-static char __pyx_k__InvalidConfig[] = "InvalidConfig";
-static char __pyx_k____metaclass__[] = "__metaclass__";
-static char __pyx_k__NotImplemented[] = "NotImplemented";
-static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
-static PyObject *__pyx_kp_s_10;
-static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_12;
-static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_15;
-static PyObject *__pyx_n_s_16;
-static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_18;
-static PyObject *__pyx_kp_s_20;
-static PyObject *__pyx_kp_s_22;
-static PyObject *__pyx_kp_s_23;
-static PyObject *__pyx_kp_s_26;
-static PyObject *__pyx_kp_s_27;
-static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_29;
-static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_s_30;
-static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_kp_s_33;
-static PyObject *__pyx_kp_s_34;
-static PyObject *__pyx_kp_s_37;
-static PyObject *__pyx_n_s_38;
-static PyObject *__pyx_n_s_39;
-static PyObject *__pyx_kp_s_4;
-static PyObject *__pyx_kp_s_40;
-static PyObject *__pyx_kp_s_42;
-static PyObject *__pyx_kp_s_44;
-static PyObject *__pyx_kp_s_46;
-static PyObject *__pyx_kp_s_47;
-static PyObject *__pyx_kp_s_48;
-static PyObject *__pyx_kp_s_49;
-static PyObject *__pyx_kp_s_50;
-static PyObject *__pyx_kp_s_53;
-static PyObject *__pyx_n_s_54;
-static PyObject *__pyx_n_s_55;
-static PyObject *__pyx_kp_s_58;
-static PyObject *__pyx_kp_s_66;
-static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_8;
-static PyObject *__pyx_kp_s_9;
-static PyObject *__pyx_n_s__BLEU;
-static PyObject *__pyx_n_s__CER;
-static PyObject *__pyx_n_s__Exception;
-static PyObject *__pyx_n_s__IBM_BLEU;
-static PyObject *__pyx_n_s__IndexError;
-static PyObject *__pyx_n_s__InvalidConfig;
-static PyObject *__pyx_n_s__KeyError;
-static PyObject *__pyx_n_s__NotImplemented;
-static PyObject *__pyx_n_s__ParseFailed;
-static PyObject *__pyx_n_s__QCRI;
-static PyObject *__pyx_n_s__QCRI_BLEU;
-static PyObject *__pyx_n_s__SSK;
-static PyObject *__pyx_n_s__TER;
-static PyObject *__pyx_n_s__TypeError;
-static PyObject *__pyx_n_s__ValueError;
-static PyObject *__pyx_n_s____class__;
-static PyObject *__pyx_n_s____dict__;
-static PyObject *__pyx_n_s____enter__;
-static PyObject *__pyx_n_s____exit__;
-static PyObject *__pyx_n_s____import__;
-static PyObject *__pyx_n_s____init__;
-static PyObject *__pyx_n_s____main__;
-static PyObject *__pyx_n_s____metaclass__;
-static PyObject *__pyx_n_s____module__;
-static PyObject *__pyx_n_s____name__;
-static PyObject *__pyx_n_s____pyx_vtable__;
-static PyObject *__pyx_n_s____qualname__;
-static PyObject *__pyx_n_s____test__;
-static PyObject *__pyx_n_s___make_config;
-static PyObject *__pyx_n_s___phrase;
-static PyObject *__pyx_n_s___sa;
-static PyObject *__pyx_n_s__a;
-static PyObject *__pyx_n_s__alignments;
-static PyObject *__pyx_n_s__append;
-static PyObject *__pyx_n_s__args;
-static PyObject *__pyx_n_s__beam_alpha;
-static PyObject *__pyx_n_s__cat;
-static PyObject *__pyx_n_s__close;
-static PyObject *__pyx_n_s__config;
-static PyObject *__pyx_n_s__config_str;
-static PyObject *__pyx_n_s__csplit;
-static PyObject *__pyx_n_s__delta;
-static PyObject *__pyx_n_s__density;
-static PyObject *__pyx_n_s__dot;
-static PyObject *__pyx_n_s__e;
-static PyObject *__pyx_n_s__encode;
-static PyObject *__pyx_n_s__encoding;
-static PyObject *__pyx_n_s__enumerate;
-static PyObject *__pyx_n_s__eval;
-static PyObject *__pyx_n_s__evaluate;
-static PyObject *__pyx_n_s__evaluator;
-static PyObject *__pyx_n_s__f;
-static PyObject *__pyx_n_s__formalism;
-static PyObject *__pyx_n_s__format;
-static PyObject *__pyx_n_s__fst;
-static PyObject *__pyx_n_s__genexpr;
-static PyObject *__pyx_n_s__get;
-static PyObject *__pyx_n_s__grammar;
-static PyObject *__pyx_n_s__hyp;
-static PyObject *__pyx_n_s__hypergraph;
-static PyObject *__pyx_n_s__i;
-static PyObject *__pyx_n_s__in_edges;
-static PyObject *__pyx_n_s__info;
-static PyObject *__pyx_n_s__inp;
-static PyObject *__pyx_n_s__items;
-static PyObject *__pyx_n_s__join;
-static PyObject *__pyx_n_s__k;
-static PyObject *__pyx_n_s__key;
-static PyObject *__pyx_n_s__label;
-static PyObject *__pyx_n_s__lexalign;
-static PyObject *__pyx_n_s__lextrans;
-static PyObject *__pyx_n_s__lhs;
-static PyObject *__pyx_n_s__lines;
-static PyObject *__pyx_n_s__name;
-static PyObject *__pyx_n_s__open;
-static PyObject *__pyx_n_s__pb;
-static PyObject *__pyx_n_s__phrase;
-static PyObject *__pyx_n_s__plf;
-static PyObject *__pyx_n_s__range;
-static PyObject *__pyx_n_s__ref;
-static PyObject *__pyx_n_s__refs;
-static PyObject *__pyx_n_s__replace;
-static PyObject *__pyx_n_s__rhs;
-static PyObject *__pyx_n_s__rules;
-static PyObject *__pyx_n_s__scfg;
-static PyObject *__pyx_n_s__score;
-static PyObject *__pyx_n_s__scores;
-static PyObject *__pyx_n_s__self;
-static PyObject *__pyx_n_s__send;
-static PyObject *__pyx_n_s__sentence;
-static PyObject *__pyx_n_s__set_silent;
-static PyObject *__pyx_n_s__span;
-static PyObject *__pyx_n_s__split;
-static PyObject *__pyx_n_s__startswith;
-static PyObject *__pyx_n_s__strip;
-static PyObject *__pyx_n_s__super;
-static PyObject *__pyx_n_s__tagger;
-static PyObject *__pyx_n_s__text;
-static PyObject *__pyx_n_s__throw;
-static PyObject *__pyx_n_s__utf8;
-static PyObject *__pyx_n_s__value;
-static PyObject *__pyx_n_s__weight;
-static PyObject *__pyx_n_s__yn;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_29_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static char __pyx_k_a[] = "a";
+static char __pyx_k_d[] = "[%d]";
+static char __pyx_k_e[] = "e";
+static char __pyx_k_f[] = "f";
+static char __pyx_k_i[] = "i";
+static char __pyx_k_k[] = "k";
+static char __pyx_k_s[] = "[%s]";
+static char __pyx_k__4[] = " ";
+static char __pyx_k_pb[] = "pb";
+static char __pyx_k_sa[] = "_sa";
+static char __pyx_k_yn[] = "yn";
+static char __pyx_k_CER[] = "CER";
+static char __pyx_k_SSK[] = "SSK";
+static char __pyx_k_TER[] = "TER";
+static char __pyx_k__10[] = "\"";
+static char __pyx_k__11[] = "\\\"";
+static char __pyx_k__13[] = "}";
+static char __pyx_k__16[] = "\n";
+static char __pyx_k__20[] = "#";
+static char __pyx_k__23[] = "*";
+static char __pyx_k_cat[] = "cat";
+static char __pyx_k_doc[] = "__doc__";
+static char __pyx_k_dot[] = "dot";
+static char __pyx_k_fst[] = "fst";
+static char __pyx_k_get[] = "__get__";
+static char __pyx_k_hyp[] = "hyp";
+static char __pyx_k_inp[] = "inp";
+static char __pyx_k_key[] = "key";
+static char __pyx_k_lhs[] = "lhs";
+static char __pyx_k_plf[] = "plf";
+static char __pyx_k_ref[] = "ref";
+static char __pyx_k_rhs[] = "rhs";
+static char __pyx_k_s_d[] = "[%s,%d]";
+static char __pyx_k_s_s[] = "%s=%s";
+static char __pyx_k_t2s[] = "t2s";
+static char __pyx_k_BLEU[] = "BLEU";
+static char __pyx_k_QCRI[] = "QCRI";
+static char __pyx_k_args[] = "args";
+static char __pyx_k_eval[] = "eval";
+static char __pyx_k_exit[] = "__exit__";
+static char __pyx_k_info[] = "info";
+static char __pyx_k_init[] = "__init__";
+static char __pyx_k_iter[] = "__iter__";
+static char __pyx_k_join[] = "join";
+static char __pyx_k_main[] = "__main__";
+static char __pyx_k_name[] = "name";
+static char __pyx_k_open[] = "open";
+static char __pyx_k_refs[] = "refs";
+static char __pyx_k_scfg[] = "scfg";
+static char __pyx_k_self[] = "self";
+static char __pyx_k_send[] = "send";
+static char __pyx_k_span[] = "span";
+static char __pyx_k_test[] = "__test__";
+static char __pyx_k_text[] = "text";
+static char __pyx_k_utf8[] = "utf8";
+static char __pyx_k_class[] = "__class__";
+static char __pyx_k_close[] = "close";
+static char __pyx_k_delta[] = "delta";
+static char __pyx_k_enter[] = "__enter__";
+static char __pyx_k_get_2[] = "get";
+static char __pyx_k_items[] = "items";
+static char __pyx_k_kbest[] = "kbest";
+static char __pyx_k_label[] = "label";
+static char __pyx_k_lines[] = "lines";
+static char __pyx_k_range[] = "range";
+static char __pyx_k_rules[] = "rules";
+static char __pyx_k_s_s_2[] = "%s %s";
+static char __pyx_k_s_s_3[] = "%s = %s";
+static char __pyx_k_score[] = "score";
+static char __pyx_k_split[] = "split";
+static char __pyx_k_strip[] = "strip";
+static char __pyx_k_super[] = "super";
+static char __pyx_k_throw[] = "throw";
+static char __pyx_k_value[] = "value";
+static char __pyx_k_append[] = "append";
+static char __pyx_k_config[] = "config";
+static char __pyx_k_csplit[] = "csplit";
+static char __pyx_k_encode[] = "encode";
+static char __pyx_k_format[] = "format";
+static char __pyx_k_import[] = "__import__";
+static char __pyx_k_module[] = "__module__";
+static char __pyx_k_name_2[] = "__name__";
+static char __pyx_k_phrase[] = "_phrase";
+static char __pyx_k_sample[] = "sample";
+static char __pyx_k_scores[] = "scores";
+static char __pyx_k_tagger[] = "tagger";
+static char __pyx_k_weight[] = "weight";
+static char __pyx_k_density[] = "density";
+static char __pyx_k_genexpr[] = "genexpr";
+static char __pyx_k_grammar[] = "grammar";
+static char __pyx_k_prepare[] = "__prepare__";
+static char __pyx_k_replace[] = "replace";
+static char __pyx_k_s_s_s_s[] = "%s ||| %s ||| %s ||| %s";
+static char __pyx_k_scaling[] = "scaling";
+static char __pyx_k_weights[] = "weights";
+static char __pyx_k_IBM_BLEU[] = "IBM_BLEU";
+static char __pyx_k_KeyError[] = "KeyError";
+static char __pyx_k_encoding[] = "encoding";
+static char __pyx_k_evaluate[] = "evaluate";
+static char __pyx_k_in_edges[] = "in_edges";
+static char __pyx_k_lexalign[] = "lexalign";
+static char __pyx_k_lextrans[] = "lextrans";
+static char __pyx_k_phrase_2[] = "phrase";
+static char __pyx_k_qualname[] = "__qualname__";
+static char __pyx_k_sentence[] = "sentence";
+static char __pyx_k_Exception[] = "Exception";
+static char __pyx_k_QCRI_BLEU[] = "QCRI_BLEU";
+static char __pyx_k_TypeError[] = "TypeError";
+static char __pyx_k_enumerate[] = "enumerate";
+static char __pyx_k_evaluator[] = "evaluator";
+static char __pyx_k_formalism[] = "formalism";
+static char __pyx_k_metaclass[] = "__metaclass__";
+static char __pyx_k_IndexError[] = "IndexError";
+static char __pyx_k_ValueError[] = "ValueError";
+static char __pyx_k_alignments[] = "alignments";
+static char __pyx_k_beam_alpha[] = "beam_alpha";
+static char __pyx_k_cdec__cdec[] = "cdec._cdec";
+static char __pyx_k_config_str[] = "config_str";
+static char __pyx_k_hypergraph[] = "hypergraph";
+static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static char __pyx_k_rankdir_LR[] = "rankdir = LR;";
+static char __pyx_k_set_silent[] = "set_silent";
+static char __pyx_k_startswith[] = "startswith";
+static char __pyx_k_ParseFailed[] = "ParseFailed";
+static char __pyx_k_TRule___get[] = "TRule.__get__";
+static char __pyx_k_cdec_sa__sa[] = "cdec.sa._sa";
+static char __pyx_k_d_d_label_s[] = "%d -> %d [label=\"%s\"];";
+static char __pyx_k_kbest_trees[] = "kbest_trees";
+static char __pyx_k_make_config[] = "_make_config";
+static char __pyx_k_sample_trees[] = "sample_trees";
+static char __pyx_k_unique_kbest[] = "unique_kbest";
+static char __pyx_k_InvalidConfig[] = "InvalidConfig";
+static char __pyx_k_Grammar___iter[] = "Grammar.__iter__";
+static char __pyx_k_Lattice___iter[] = "Lattice.__iter__";
+static char __pyx_k_NotImplemented[] = "NotImplemented";
+static char __pyx_k_kbest_features[] = "kbest_features";
+static char __pyx_k_digraph_lattice[] = "digraph lattice {";
+static char __pyx_k_Hypergraph___get[] = "Hypergraph.__get__";
+static char __pyx_k_Hypergraph_kbest[] = "Hypergraph.kbest";
+static char __pyx_k_Hypergraph_sample[] = "Hypergraph.sample";
+static char __pyx_k_node_shape_circle[] = "node [shape=circle];";
+static char __pyx_k_sample_hypotheses[] = "sample_hypotheses";
+static char __pyx_k_DenseVector___iter[] = "DenseVector.__iter__";
+static char __pyx_k_todot_locals_lines[] = "todot.<locals>.lines";
+static char __pyx_k_unique_kbest_trees[] = "unique_kbest_trees";
+static char __pyx_k_CandidateSet___iter[] = "CandidateSet.__iter__";
+static char __pyx_k_SparseVector___iter[] = "SparseVector.__iter__";
+static char __pyx_k_formalism_s_unknown[] = "formalism \"%s\" unknown";
+static char __pyx_k_HypergraphEdge___get[] = "HypergraphEdge.__get__";
+static char __pyx_k_HypergraphNode___get[] = "HypergraphNode.__get__";
+static char __pyx_k_d_shape_doublecircle[] = "%d [shape=doublecircle]";
+static char __pyx_k_str___locals_genexpr[] = "__str__.<locals>.genexpr";
+static char __pyx_k_init___locals_genexpr[] = "__init__.<locals>.genexpr";
+static char __pyx_k_phrase_locals_genexpr[] = "_phrase.<locals>.genexpr";
+static char __pyx_k_unique_kbest_features[] = "unique_kbest_features";
+static char __pyx_k_Hypergraph_kbest_trees[] = "Hypergraph.kbest_trees";
+static char __pyx_k_SufficientStats___iter[] = "SufficientStats.__iter__";
+static char __pyx_k_Hypergraph_sample_trees[] = "Hypergraph.sample_trees";
+static char __pyx_k_Hypergraph_unique_kbest[] = "Hypergraph.unique_kbest";
+static char __pyx_k_Hypergraph_kbest_features[] = "Hypergraph.kbest_features";
+static char __pyx_k_csplit_preserve_full_word[] = "csplit_preserve_full_word";
+static char __pyx_k_lattice_index_out_of_range[] = "lattice index out of range";
+static char __pyx_k_Cannot_convert_type_s_to_str[] = "Cannot convert type %s to str";
+static char __pyx_k_Hypergraph_sample_hypotheses[] = "Hypergraph.sample_hypotheses";
+static char __pyx_k_cannot_create_lattice_from_s[] = "cannot create lattice from %s";
+static char __pyx_k_Cannot_translate_input_type_s[] = "Cannot translate input type %s";
+static char __pyx_k_Hypergraph_unique_kbest_trees[] = "Hypergraph.unique_kbest_trees";
+static char __pyx_k_Users_waziz_workspace_mtm14_my[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/lattice.pxi";
+static char __pyx_k_cannot_reweight_hypergraph_with[] = "cannot reweight hypergraph with %s";
+static char __pyx_k_Hypergraph_unique_kbest_features[] = "Hypergraph.unique_kbest_features";
+static char __pyx_k_Users_waziz_workspace_mtm14_my_2[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/grammar.pxi";
+static char __pyx_k_Users_waziz_workspace_mtm14_my_3[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/_cdec.pyx";
+static char __pyx_k_candidate_set_index_out_of_range[] = "candidate set index out of range";
+static char __pyx_k_cannot_initialize_weights_with_s[] = "cannot initialize weights with %s";
+static char __pyx_k_cannot_intersect_hypergraph_with[] = "cannot intersect hypergraph with %s";
+static char __pyx_k_cannot_take_the_dot_product_of_s[] = "cannot take the dot product of %s and SparseVector";
+static char __pyx_k_comparison_not_implemented_for_H[] = "comparison not implemented for HypergraphEdge";
+static char __pyx_k_comparison_not_implemented_for_S[] = "comparison not implemented for SparseVector";
+static char __pyx_k_sufficient_stats_vector_index_ou[] = "sufficient stats vector index out of range";
+static char __pyx_k_the_grammar_should_contain_TRule[] = "the grammar should contain TRule objects";
+static char __pyx_k_comparison_not_implemented_for_H_2[] = "comparison not implemented for HypergraphNode";
+static PyObject *__pyx_n_s_BLEU;
+static PyObject *__pyx_n_s_CER;
+static PyObject *__pyx_n_s_CandidateSet___iter;
+static PyObject *__pyx_kp_s_Cannot_translate_input_type_s;
+static PyObject *__pyx_n_s_DenseVector___iter;
+static PyObject *__pyx_n_s_Exception;
+static PyObject *__pyx_n_s_Grammar___iter;
+static PyObject *__pyx_n_s_HypergraphEdge___get;
+static PyObject *__pyx_n_s_HypergraphNode___get;
+static PyObject *__pyx_n_s_Hypergraph___get;
+static PyObject *__pyx_n_s_Hypergraph_kbest;
+static PyObject *__pyx_n_s_Hypergraph_kbest_features;
+static PyObject *__pyx_n_s_Hypergraph_kbest_trees;
+static PyObject *__pyx_n_s_Hypergraph_sample;
+static PyObject *__pyx_n_s_Hypergraph_sample_hypotheses;
+static PyObject *__pyx_n_s_Hypergraph_sample_trees;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest_features;
+static PyObject *__pyx_n_s_Hypergraph_unique_kbest_trees;
+static PyObject *__pyx_n_s_IBM_BLEU;
+static PyObject *__pyx_n_s_IndexError;
+static PyObject *__pyx_n_s_InvalidConfig;
+static PyObject *__pyx_n_s_KeyError;
+static PyObject *__pyx_n_s_Lattice___iter;
+static PyObject *__pyx_n_s_NotImplemented;
+static PyObject *__pyx_n_s_ParseFailed;
+static PyObject *__pyx_n_s_QCRI;
+static PyObject *__pyx_n_s_QCRI_BLEU;
+static PyObject *__pyx_n_s_SSK;
+static PyObject *__pyx_n_s_SparseVector___iter;
+static PyObject *__pyx_n_s_SufficientStats___iter;
+static PyObject *__pyx_n_s_TER;
+static PyObject *__pyx_n_s_TRule___get;
+static PyObject *__pyx_n_s_TypeError;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my_2;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my_3;
+static PyObject *__pyx_n_s_ValueError;
+static PyObject *__pyx_kp_s__10;
+static PyObject *__pyx_kp_s__11;
+static PyObject *__pyx_kp_s__13;
+static PyObject *__pyx_kp_s__16;
+static PyObject *__pyx_kp_s__20;
+static PyObject *__pyx_n_s__23;
+static PyObject *__pyx_kp_s__4;
+static PyObject *__pyx_n_s_a;
+static PyObject *__pyx_n_s_alignments;
+static PyObject *__pyx_n_s_append;
+static PyObject *__pyx_n_s_args;
+static PyObject *__pyx_n_s_beam_alpha;
+static PyObject *__pyx_kp_s_candidate_set_index_out_of_range;
+static PyObject *__pyx_kp_s_cannot_create_lattice_from_s;
+static PyObject *__pyx_kp_s_cannot_initialize_weights_with_s;
+static PyObject *__pyx_kp_s_cannot_intersect_hypergraph_with;
+static PyObject *__pyx_kp_s_cannot_reweight_hypergraph_with;
+static PyObject *__pyx_kp_s_cannot_take_the_dot_product_of_s;
+static PyObject *__pyx_n_s_cat;
+static PyObject *__pyx_n_s_cdec__cdec;
+static PyObject *__pyx_n_s_cdec_sa__sa;
+static PyObject *__pyx_n_s_class;
+static PyObject *__pyx_n_s_close;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_H;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_H_2;
+static PyObject *__pyx_kp_s_comparison_not_implemented_for_S;
+static PyObject *__pyx_n_s_config;
+static PyObject *__pyx_n_s_config_str;
+static PyObject *__pyx_n_s_csplit;
+static PyObject *__pyx_n_s_csplit_preserve_full_word;
+static PyObject *__pyx_kp_s_d;
+static PyObject *__pyx_kp_s_d_d_label_s;
+static PyObject *__pyx_kp_s_d_shape_doublecircle;
+static PyObject *__pyx_n_s_delta;
+static PyObject *__pyx_n_s_density;
+static PyObject *__pyx_kp_s_digraph_lattice;
+static PyObject *__pyx_n_s_doc;
+static PyObject *__pyx_n_s_dot;
+static PyObject *__pyx_n_s_e;
+static PyObject *__pyx_n_s_encode;
+static PyObject *__pyx_n_s_encoding;
+static PyObject *__pyx_n_s_enter;
+static PyObject *__pyx_n_s_enumerate;
+static PyObject *__pyx_n_s_eval;
+static PyObject *__pyx_n_s_evaluate;
+static PyObject *__pyx_n_s_evaluator;
+static PyObject *__pyx_n_s_exit;
+static PyObject *__pyx_n_s_f;
+static PyObject *__pyx_n_s_formalism;
+static PyObject *__pyx_kp_s_formalism_s_unknown;
+static PyObject *__pyx_n_s_format;
+static PyObject *__pyx_n_s_fst;
+static PyObject *__pyx_n_s_genexpr;
+static PyObject *__pyx_n_s_get;
+static PyObject *__pyx_n_s_get_2;
+static PyObject *__pyx_n_s_grammar;
+static PyObject *__pyx_n_s_hyp;
+static PyObject *__pyx_n_s_hypergraph;
+static PyObject *__pyx_n_s_i;
+static PyObject *__pyx_n_s_import;
+static PyObject *__pyx_n_s_in_edges;
+static PyObject *__pyx_n_s_info;
+static PyObject *__pyx_n_s_init;
+static PyObject *__pyx_n_s_init___locals_genexpr;
+static PyObject *__pyx_n_s_inp;
+static PyObject *__pyx_n_s_items;
+static PyObject *__pyx_n_s_iter;
+static PyObject *__pyx_n_s_join;
+static PyObject *__pyx_n_s_k;
+static PyObject *__pyx_n_s_kbest;
+static PyObject *__pyx_n_s_kbest_features;
+static PyObject *__pyx_n_s_kbest_trees;
+static PyObject *__pyx_n_s_key;
+static PyObject *__pyx_n_s_label;
+static PyObject *__pyx_kp_s_lattice_index_out_of_range;
+static PyObject *__pyx_n_s_lexalign;
+static PyObject *__pyx_n_s_lextrans;
+static PyObject *__pyx_n_s_lhs;
+static PyObject *__pyx_n_s_lines;
+static PyObject *__pyx_n_s_main;
+static PyObject *__pyx_n_s_make_config;
+static PyObject *__pyx_n_s_metaclass;
+static PyObject *__pyx_n_s_module;
+static PyObject *__pyx_n_s_name;
+static PyObject *__pyx_n_s_name_2;
+static PyObject *__pyx_kp_s_node_shape_circle;
+static PyObject *__pyx_n_s_open;
+static PyObject *__pyx_n_s_pb;
+static PyObject *__pyx_n_s_phrase;
+static PyObject *__pyx_n_s_phrase_2;
+static PyObject *__pyx_n_s_phrase_locals_genexpr;
+static PyObject *__pyx_n_s_plf;
+static PyObject *__pyx_n_s_prepare;
+static PyObject *__pyx_n_s_pyx_vtable;
+static PyObject *__pyx_n_s_qualname;
+static PyObject *__pyx_n_s_range;
+static PyObject *__pyx_kp_s_rankdir_LR;
+static PyObject *__pyx_n_s_ref;
+static PyObject *__pyx_n_s_refs;
+static PyObject *__pyx_n_s_replace;
+static PyObject *__pyx_n_s_rhs;
+static PyObject *__pyx_n_s_rules;
+static PyObject *__pyx_kp_s_s;
+static PyObject *__pyx_kp_s_s_d;
+static PyObject *__pyx_kp_s_s_s;
+static PyObject *__pyx_kp_s_s_s_2;
+static PyObject *__pyx_kp_s_s_s_3;
+static PyObject *__pyx_kp_s_s_s_s_s;
+static PyObject *__pyx_n_s_sa;
+static PyObject *__pyx_n_s_sample;
+static PyObject *__pyx_n_s_sample_hypotheses;
+static PyObject *__pyx_n_s_sample_trees;
+static PyObject *__pyx_n_s_scaling;
+static PyObject *__pyx_n_s_scfg;
+static PyObject *__pyx_n_s_score;
+static PyObject *__pyx_n_s_scores;
+static PyObject *__pyx_n_s_self;
+static PyObject *__pyx_n_s_send;
+static PyObject *__pyx_n_s_sentence;
+static PyObject *__pyx_n_s_set_silent;
+static PyObject *__pyx_n_s_span;
+static PyObject *__pyx_n_s_split;
+static PyObject *__pyx_n_s_startswith;
+static PyObject *__pyx_n_s_str___locals_genexpr;
+static PyObject *__pyx_n_s_strip;
+static PyObject *__pyx_kp_s_sufficient_stats_vector_index_ou;
+static PyObject *__pyx_n_s_super;
+static PyObject *__pyx_n_s_t2s;
+static PyObject *__pyx_n_s_tagger;
+static PyObject *__pyx_n_s_test;
+static PyObject *__pyx_n_s_text;
+static PyObject *__pyx_kp_s_the_grammar_should_contain_TRule;
+static PyObject *__pyx_n_s_throw;
+static PyObject *__pyx_n_s_todot_locals_lines;
+static PyObject *__pyx_n_s_unique_kbest;
+static PyObject *__pyx_n_s_unique_kbest_features;
+static PyObject *__pyx_n_s_unique_kbest_trees;
+static PyObject *__pyx_n_s_utf8;
+static PyObject *__pyx_n_s_value;
+static PyObject *__pyx_n_s_weight;
+static PyObject *__pyx_n_s_weights;
+static PyObject *__pyx_n_s_yn;
+static PyObject *__pyx_float_1_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
-static PyObject *__pyx_k_tuple_2;
-static PyObject *__pyx_k_tuple_5;
-static PyObject *__pyx_k_tuple_6;
-static PyObject *__pyx_k_tuple_14;
-static PyObject *__pyx_k_tuple_19;
-static PyObject *__pyx_k_tuple_21;
-static PyObject *__pyx_k_tuple_24;
-static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_32;
-static PyObject *__pyx_k_tuple_35;
-static PyObject *__pyx_k_tuple_41;
-static PyObject *__pyx_k_tuple_43;
-static PyObject *__pyx_k_tuple_45;
-static PyObject *__pyx_k_tuple_51;
-static PyObject *__pyx_k_tuple_52;
-static PyObject *__pyx_k_tuple_56;
-static PyObject *__pyx_k_tuple_59;
-static PyObject *__pyx_k_tuple_60;
-static PyObject *__pyx_k_tuple_61;
-static PyObject *__pyx_k_tuple_62;
-static PyObject *__pyx_k_tuple_63;
-static PyObject *__pyx_k_tuple_64;
-static PyObject *__pyx_k_tuple_67;
-static PyObject *__pyx_k_codeobj_36;
-static PyObject *__pyx_k_codeobj_57;
-static PyObject *__pyx_k_codeobj_65;
-static PyObject *__pyx_k_codeobj_68;
+static PyObject *__pyx_tuple_;
+static PyObject *__pyx_tuple__2;
+static PyObject *__pyx_tuple__3;
+static PyObject *__pyx_tuple__5;
+static PyObject *__pyx_tuple__6;
+static PyObject *__pyx_tuple__7;
+static PyObject *__pyx_tuple__8;
+static PyObject *__pyx_tuple__9;
+static PyObject *__pyx_tuple__12;
+static PyObject *__pyx_tuple__14;
+static PyObject *__pyx_tuple__17;
+static PyObject *__pyx_tuple__18;
+static PyObject *__pyx_tuple__19;
+static PyObject *__pyx_tuple__21;
+static PyObject *__pyx_tuple__22;
+static PyObject *__pyx_tuple__24;
+static PyObject *__pyx_tuple__26;
+static PyObject *__pyx_tuple__27;
+static PyObject *__pyx_tuple__28;
+static PyObject *__pyx_tuple__29;
+static PyObject *__pyx_tuple__30;
+static PyObject *__pyx_tuple__31;
+static PyObject *__pyx_tuple__33;
+static PyObject *__pyx_codeobj__15;
+static PyObject *__pyx_codeobj__25;
+static PyObject *__pyx_codeobj__32;
+static PyObject *__pyx_codeobj__34;
/* "cdec/_cdec.pyx":6
* cimport decoder
@@ -2588,7 +2674,7 @@ static PyObject *__pyx_k_codeobj_68;
*/
static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args_4cdec_5_cdec_as_str *__pyx_optional_args) {
- char *__pyx_v_error_msg = ((char *)__pyx_k_1);
+ char *__pyx_v_error_msg = ((char *)__pyx_k_Cannot_convert_type_s_to_str);
PyObject *__pyx_v_ret = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -2597,6 +2683,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -2625,12 +2712,12 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* elif isinstance(data, str):
* ret = data
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_ret = ((PyObject*)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
@@ -2654,9 +2741,11 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* else:
* raise TypeError(error_msg.format(type(data)))
*/
- if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_data);
- __pyx_v_ret = ((PyObject*)__pyx_v_data);
+ if (!(likely(PyBytes_CheckExact(__pyx_v_data))||((__pyx_v_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __pyx_v_data;
+ __Pyx_INCREF(__pyx_t_4);
+ __pyx_v_ret = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -2668,30 +2757,46 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
* return ret
*
*/
- __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_4), __pyx_n_s__format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_v_data)));
- __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
- __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)Py_TYPE(__pyx_v_data))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data)));
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)Py_TYPE(__pyx_v_data)));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data)));
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -2703,17 +2808,25 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
*
* include "vectors.pxi"
*/
- __Pyx_XDECREF(((PyObject *)__pyx_r));
- __Pyx_INCREF(((PyObject *)__pyx_v_ret));
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_ret);
__pyx_r = __pyx_v_ret;
goto __pyx_L0;
- __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":6
+ * cimport decoder
+ *
+ * cdef bytes as_str(data, char* error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<<
+ * cdef bytes ret
+ * if isinstance(data, unicode):
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec._cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -2723,6 +2836,14 @@ static PyObject *__pyx_f_4cdec_5_cdec_as_str(PyObject *__pyx_v_data, struct __py
return __pyx_r;
}
+/* "cdec/vectors.pxi":7
+ * cdef bint owned # if True, do not manage memory
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """DenseVector() -> Dense weight/feature vector."""
+ * self.vector = new vector[weight_t]()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector___init__[] = "DenseVector() -> Dense weight/feature vector.";
@@ -2737,28 +2858,22 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self,
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector___init__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":7
- * cdef bint owned # if True, do not manage memory
- *
- * def __init__(self): # <<<<<<<<<<<<<<
- * """DenseVector() -> Dense weight/feature vector."""
- * self.vector = new vector[weight_t]()
- */
-
static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
- std::vector<weight_t> *__pyx_t_1;
+ std::vector<weight_t> *__pyx_t_1;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":9
+ /* "cdec/vectors.pxi":9
* def __init__(self):
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]() # <<<<<<<<<<<<<<
@@ -2766,14 +2881,14 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
*
*/
try {
- __pyx_t_1 = new std::vector<weight_t>();
+ __pyx_t_1 = new std::vector<weight_t> ();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->vector = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":10
+ /* "cdec/vectors.pxi":10
* """DenseVector() -> Dense weight/feature vector."""
* self.vector = new vector[weight_t]()
* self.owned = False # <<<<<<<<<<<<<<
@@ -2782,6 +2897,15 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
*/
__pyx_v_self->owned = 0;
+ /* "cdec/vectors.pxi":7
+ * cdef bint owned # if True, do not manage memory
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """DenseVector() -> Dense weight/feature vector."""
+ * self.vector = new vector[weight_t]()
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -2792,29 +2916,31 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "cdec/vectors.pxi":12
+ * self.owned = False
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * if not self.owned:
+ * del self.vector
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":12
- * self.owned = False
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * if not self.owned:
- * del self.vector
- */
-
static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":13
+ /* "cdec/vectors.pxi":13
*
* def __dealloc__(self):
* if not self.owned: # <<<<<<<<<<<<<<
@@ -2824,7 +2950,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":14
+ /* "cdec/vectors.pxi":14
* def __dealloc__(self):
* if not self.owned:
* del self.vector # <<<<<<<<<<<<<<
@@ -2836,9 +2962,26 @@ static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4c
}
__pyx_L3:;
+ /* "cdec/vectors.pxi":12
+ * self.owned = False
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * if not self.owned:
+ * del self.vector
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/vectors.pxi":16
+ * del self.vector
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self) {
@@ -2846,24 +2989,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":16
- * del self.vector
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.vector.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":17
+ /* "cdec/vectors.pxi":17
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -2873,12 +3010,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_
__pyx_r = __pyx_v_self->vector->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/vectors.pxi":16
+ * del self.vector
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":19
+ * return self.vector.size()
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if 0 <= fid < self.vector.size():
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -2899,18 +3052,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__(PyObject *__py
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":19
- * return self.vector.size()
- *
- * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if 0 <= fid < self.vector.size():
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_v_fid;
PyObject *__pyx_r = NULL;
@@ -2924,7 +3071,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":20
+ /* "cdec/vectors.pxi":20
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -2933,7 +3080,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":21
+ /* "cdec/vectors.pxi":21
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<<
@@ -2947,7 +3094,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":22
+ /* "cdec/vectors.pxi":22
* cdef int fid = FDConvert(fname)
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid] # <<<<<<<<<<<<<<
@@ -2960,11 +3107,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":23
+ /* "cdec/vectors.pxi":23
* if 0 <= fid < self.vector.size():
* return self.vector[0][fid]
* raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -2972,21 +3117,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
* def __setitem__(self, char* fname, float value):
*/
__pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":19
+ * return self.vector.size()
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if 0 <= fid < self.vector.size():
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -2998,6 +3150,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_o
return __pyx_r;
}
+/* "cdec/vectors.pxi":25
+ * raise KeyError(fname)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
@@ -3022,18 +3182,12 @@ static int __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_se
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":25
- * raise KeyError(fname)
- *
- * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) {
int __pyx_v_fid;
int __pyx_r;
@@ -3046,7 +3200,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":26
+ /* "cdec/vectors.pxi":26
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3055,7 +3209,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":27
+ /* "cdec/vectors.pxi":27
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3065,23 +3219,21 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __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));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":28
+ /* "cdec/vectors.pxi":28
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid: # <<<<<<<<<<<<<<
@@ -3091,7 +3243,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":29
+ /* "cdec/vectors.pxi":29
* if fid < 0: raise KeyError(fname)
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1) # <<<<<<<<<<<<<<
@@ -3103,7 +3255,7 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
}
__pyx_L4:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":30
+ /* "cdec/vectors.pxi":30
* if self.vector.size() <= fid:
* self.vector.resize(fid + 1)
* self.vector[0][fid] = value # <<<<<<<<<<<<<<
@@ -3112,6 +3264,15 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
*/
((__pyx_v_self->vector[0])[__pyx_v_fid]) = __pyx_v_value;
+ /* "cdec/vectors.pxi":25
+ * raise KeyError(fname)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -3125,6 +3286,14 @@ static int __pyx_pf_4cdec_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_4cd
}
static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/vectors.pxi":32
+ * self.vector[0][fid] = value
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self) {
@@ -3132,18 +3301,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":32
- * self.vector[0][fid] = value
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned fid
- * for fid in range(1, self.vector.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -3162,18 +3325,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj
__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_11DenseVector_12generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_11DenseVector_12generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_DenseVector___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.DenseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -3204,7 +3365,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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":34
+ /* "cdec/vectors.pxi":34
* def __iter__(self):
* cdef unsigned fid
* for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<<
@@ -3215,7 +3376,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":35
+ /* "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] # <<<<<<<<<<<<<<
@@ -3223,15 +3384,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
* def dot(self, SparseVector other):
*/
__pyx_t_3 = __Pyx_PyBytes_FromString(FD::Convert(__pyx_cur_scope->__pyx_v_fid).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_self->vector[0])[__pyx_cur_scope->__pyx_v_fid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -3242,7 +3403,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -3256,6 +3417,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/vectors.pxi":32
+ * self.vector[0][fid] = value
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned fid
+ * for fid in range(1, self.vector.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -3271,6 +3442,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_Generator
return NULL;
}
+/* "cdec/vectors.pxi":37
+ * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
+ *
+ * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
+ * return other.dot(self)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector_13dot[] = "vector.dot(SparseVector other) -> Dot product of the two vectors.";
@@ -3283,6 +3462,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_sel
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_13dot(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -3291,26 +3472,19 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":37
- * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
- *
- * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
- * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
- * return other.dot(self)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":39
+ /* "cdec/vectors.pxi":39
* def dot(self, SparseVector other):
* """vector.dot(SparseVector other) -> Dot product of the two vectors."""
* return other.dot(self) # <<<<<<<<<<<<<<
@@ -3318,27 +3492,51 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cde
* def tosparse(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_v_self));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_self));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":37
+ * yield str(FDConvert(fid).c_str()), self.vector[0][fid]
+ *
+ * def dot(self, SparseVector other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector other) -> Dot product of the two vectors."""
+ * return other.dot(self)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.DenseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -3347,6 +3545,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_13dot(struct __pyx_obj_4cde
return __pyx_r;
}
+/* "cdec/vectors.pxi":41
+ * return other.dot(self)
+ *
+ * def tosparse(self): # <<<<<<<<<<<<<<
+ * """vector.tosparse() -> Equivalent SparseVector."""
+ * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse[] = "vector.tosparse() -> Equivalent SparseVector.";
@@ -3355,18 +3561,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("tosparse (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":41
- * return other.dot(self)
- *
- * def tosparse(self): # <<<<<<<<<<<<<<
- * """vector.tosparse() -> Equivalent SparseVector."""
- * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_sparse = 0;
PyObject *__pyx_r = NULL;
@@ -3377,29 +3577,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("tosparse", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":43
+ /* "cdec/vectors.pxi":43
* def tosparse(self):
* """vector.tosparse() -> Equivalent SparseVector."""
* cdef SparseVector sparse = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_sparse = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":44
+ /* "cdec/vectors.pxi":44
* """vector.tosparse() -> Equivalent SparseVector."""
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse
*/
- __pyx_v_sparse->vector = new FastSparseVector<weight_t>();
+ __pyx_v_sparse->vector = new FastSparseVector<weight_t> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":45
+ /* "cdec/vectors.pxi":45
* cdef SparseVector sparse = SparseVector.__new__(SparseVector)
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<<
@@ -3408,7 +3608,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
*/
Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":46
+ /* "cdec/vectors.pxi":46
* sparse.vector = new FastSparseVector[weight_t]()
* InitSparseVector(self.vector[0], sparse.vector)
* return sparse # <<<<<<<<<<<<<<
@@ -3420,8 +3620,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_sparse);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":41
+ * return other.dot(self)
+ *
+ * def tosparse(self): # <<<<<<<<<<<<<<
+ * """vector.tosparse() -> Equivalent SparseVector."""
+ * cdef SparseVector sparse = SparseVector.__new__(SparseVector)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.DenseVector.tosparse", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -3433,6 +3640,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/vectors.pxi":51
+ * cdef FastSparseVector[weight_t]* vector
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """SparseVector() -> Sparse feature/weight vector."""
+ * self.vector = new FastSparseVector[weight_t]()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector___init__[] = "SparseVector() -> Sparse feature/weight vector.";
@@ -3447,59 +3662,64 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector___init__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":51
- * cdef FastSparseVector[weight_t]* vector
- *
- * def __init__(self): # <<<<<<<<<<<<<<
- * """SparseVector() -> Sparse feature/weight vector."""
- * self.vector = new FastSparseVector[weight_t]()
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector___init__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":53
+ /* "cdec/vectors.pxi":53
* def __init__(self):
* """SparseVector() -> Sparse feature/weight vector."""
* self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_v_self->vector = new FastSparseVector<weight_t>();
+ __pyx_v_self->vector = new FastSparseVector<weight_t> ();
+ /* "cdec/vectors.pxi":51
+ * cdef FastSparseVector[weight_t]* vector
+ *
+ * def __init__(self): # <<<<<<<<<<<<<<
+ * """SparseVector() -> Sparse feature/weight vector."""
+ * self.vector = new FastSparseVector[weight_t]()
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":55
+ * self.vector = new FastSparseVector[weight_t]()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.vector
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":55
- * self.vector = new FastSparseVector[weight_t]()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.vector
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":56
+ /* "cdec/vectors.pxi":56
*
* def __dealloc__(self):
* del self.vector # <<<<<<<<<<<<<<
@@ -3508,9 +3728,26 @@ static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->vector;
+ /* "cdec/vectors.pxi":55
+ * self.vector = new FastSparseVector[weight_t]()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.vector
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/vectors.pxi":58
+ * del self.vector
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * """vector.copy() -> SparseVector copy."""
+ * return self * 1
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector_4copy[] = "vector.copy() -> SparseVector copy.";
@@ -3519,18 +3756,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_4copy(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":58
- * del self.vector
- *
- * def copy(self): # <<<<<<<<<<<<<<
- * """vector.copy() -> SparseVector copy."""
- * return self * 1
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -3540,7 +3771,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":60
+ /* "cdec/vectors.pxi":60
* def copy(self):
* """vector.copy() -> SparseVector copy."""
* return self * 1 # <<<<<<<<<<<<<<
@@ -3554,8 +3785,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":58
+ * del self.vector
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * """vector.copy() -> SparseVector copy."""
+ * return self * 1
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -3566,6 +3804,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_4copy(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/vectors.pxi":62
+ * return self * 1
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -3586,18 +3832,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__(PyObject *__p
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":62
- * return self * 1
- *
- * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_v_fid;
PyObject *__pyx_r = NULL;
@@ -3610,7 +3850,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":63
+ /* "cdec/vectors.pxi":63
*
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3619,7 +3859,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":64
+ /* "cdec/vectors.pxi":64
* def __getitem__(self, char* fname):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3629,23 +3869,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __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));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":65
+ /* "cdec/vectors.pxi":65
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* return self.vector.value(fid) # <<<<<<<<<<<<<<
@@ -3659,8 +3897,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":62
+ * return self * 1
+ *
+ * def __getitem__(self, char* fname): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
@@ -3672,6 +3917,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(struct __pyx_
return __pyx_r;
}
+/* "cdec/vectors.pxi":67
+ * return self.vector.value(fid)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) {
@@ -3696,18 +3949,12 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_s
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":67
- * return self.vector.value(fid)
- *
- * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
- * cdef int fid = FDConvert(fname)
- * if fid < 0: raise KeyError(fname)
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) {
int __pyx_v_fid;
int __pyx_r;
@@ -3720,7 +3967,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":68
+ /* "cdec/vectors.pxi":68
*
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<<
@@ -3729,7 +3976,7 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
*/
__pyx_v_fid = FD::Convert(__pyx_v_fname);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":69
+ /* "cdec/vectors.pxi":69
* def __setitem__(self, char* fname, float value):
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -3739,23 +3986,21 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
__pyx_t_1 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_1) {
__pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_fname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":70
+ /* "cdec/vectors.pxi":70
* cdef int fid = FDConvert(fname)
* if fid < 0: raise KeyError(fname)
* self.vector.set_value(fid, value) # <<<<<<<<<<<<<<
@@ -3764,6 +4009,15 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
*/
__pyx_v_self->vector->set_value(__pyx_v_fid, __pyx_v_value);
+ /* "cdec/vectors.pxi":67
+ * return self.vector.value(fid)
+ *
+ * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<<
+ * cdef int fid = FDConvert(fname)
+ * if fid < 0: raise KeyError(fname)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -3777,6 +4031,14 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_4c
}
static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/vectors.pxi":72
+ * self.vector.set_value(fid, value)
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self) {
@@ -3784,18 +4046,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":72
- * self.vector.set_value(fid, value)
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
- * cdef unsigned i
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -3814,18 +4070,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(struct __pyx_ob
__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_12SparseVector_12generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12SparseVector_12generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SparseVector___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.SparseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -3841,6 +4095,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -3856,16 +4119,16 @@ 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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":73
+ /* "cdec/vectors.pxi":73
*
* def __iter__(self):
* cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<<
* cdef unsigned i
* try:
*/
- __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t>::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
+ __pyx_cur_scope->__pyx_v_it = new FastSparseVector<weight_t> ::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":75
+ /* "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: # <<<<<<<<<<<<<<
@@ -3874,7 +4137,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":76
+ /* "cdec/vectors.pxi":76
* cdef unsigned i
* try:
* for i in range(self.vector.size()): # <<<<<<<<<<<<<<
@@ -3885,26 +4148,26 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":77
+ /* "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) # <<<<<<<<<<<<<<
* pinc(it[0]) # ++it
* finally:
*/
- __pyx_t_3 = __Pyx_PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(FD::Convert((__pyx_cur_scope->__pyx_v_it[0]).operator->()->first).c_str()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble((__pyx_cur_scope->__pyx_v_it[0]).operator->()->second); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
@@ -3912,7 +4175,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -3924,9 +4187,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
__pyx_L9_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":78
+ /* "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 # <<<<<<<<<<<<<<
@@ -3937,7 +4200,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":80
+ /* "cdec/vectors.pxi":80
* pinc(it[0]) # ++it
* finally:
* del it # <<<<<<<<<<<<<<
@@ -3945,33 +4208,54 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
* def dot(self, other):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_it;
+ goto __pyx_L6;
+ }
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
- goto __pyx_L6;
- }
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_it;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_it;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/vectors.pxi":72
+ * self.vector.set_value(fid, value)
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False)
+ * cdef unsigned i
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -3987,6 +4271,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_Generat
return NULL;
}
+/* "cdec/vectors.pxi":82
+ * del it
+ *
+ * def dot(self, other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
+ * if isinstance(other, DenseVector):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12SparseVector_13dot[] = "vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.";
@@ -3995,18 +4287,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_13dot(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":82
- * del it
- *
- * def dot(self, other): # <<<<<<<<<<<<<<
- * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
- * if isinstance(other, DenseVector):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -4019,7 +4305,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dot", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":84
+ /* "cdec/vectors.pxi":84
* def dot(self, other):
* """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
* if isinstance(other, DenseVector): # <<<<<<<<<<<<<<
@@ -4030,7 +4316,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":85
+ /* "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]) # <<<<<<<<<<<<<<
@@ -4043,10 +4329,9 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":86
+ /* "cdec/vectors.pxi":86
* if isinstance(other, DenseVector):
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector): # <<<<<<<<<<<<<<
@@ -4057,7 +4342,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":87
+ /* "cdec/vectors.pxi":87
* return self.vector.dot((<DenseVector> other).vector[0])
* elif isinstance(other, SparseVector):
* return self.vector.dot((<SparseVector> other).vector[0]) # <<<<<<<<<<<<<<
@@ -4070,33 +4355,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":88
+ /* "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)) # <<<<<<<<<<<<<<
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_cannot_take_the_dot_product_of_s, ((PyObject *)Py_TYPE(__pyx_v_other))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":82
+ * del it
+ *
+ * def dot(self, other): # <<<<<<<<<<<<<<
+ * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."""
+ * if isinstance(other, DenseVector):
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -4108,6 +4398,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "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): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.vector[0] == y.vector[0]
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -4120,6 +4418,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y), ((int)__pyx_v_op));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4128,14 +4428,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__(PyObject *__
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/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): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.vector[0] == y.vector[0]
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -4146,7 +4438,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":93
+ /* "cdec/vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -4155,7 +4447,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":91
+ /* "cdec/vectors.pxi":91
*
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -4164,7 +4456,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":92
+ /* "cdec/vectors.pxi":92
* def __richcmp__(SparseVector x, SparseVector y, int op):
* if op == 2: # ==
* return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<<
@@ -4179,7 +4471,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
goto __pyx_L0;
break;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":93
+ /* "cdec/vectors.pxi":93
* if op == 2: # ==
* return x.vector[0] == y.vector[0]
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -4188,7 +4480,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":94
+ /* "cdec/vectors.pxi":94
* return x.vector[0] == y.vector[0]
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -4205,23 +4497,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
__pyx_t_1 = 0;
goto __pyx_L0;
break;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":95
+ /* "cdec/vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __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[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "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): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.vector[0] == y.vector[0]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4232,6 +4532,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_15__richcmp__(struct __pyx
return __pyx_r;
}
+/* "cdec/vectors.pxi":97
+ * raise NotImplemented('comparison not implemented for SparseVector')
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self) {
@@ -4239,24 +4547,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":97
- * raise NotImplemented('comparison not implemented for SparseVector')
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.vector.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":98
+ /* "cdec/vectors.pxi":98
*
* def __len__(self):
* return self.vector.size() # <<<<<<<<<<<<<<
@@ -4266,12 +4568,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_ob
__pyx_r = __pyx_v_self->vector->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/vectors.pxi":97
+ * raise NotImplemented('comparison not implemented for SparseVector')
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.vector.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":100
+ * return self.vector.size()
+ *
+ * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) {
@@ -4292,24 +4610,18 @@ static int __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":100
- * return self.vector.size()
- *
- * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
- * return self.vector.nonzero(FDConvert(fname))
- *
- */
-
static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":101
+ /* "cdec/vectors.pxi":101
*
* def __contains__(self, char* fname):
* return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<<
@@ -4319,12 +4631,28 @@ static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_
__pyx_r = __pyx_v_self->vector->nonzero(FD::Convert(__pyx_v_fname));
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/vectors.pxi":100
+ * return self.vector.size()
+ *
+ * def __contains__(self, char* fname): # <<<<<<<<<<<<<<
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":103
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ * def __neg__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](self.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self) {
@@ -4332,18 +4660,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":103
- * return self.vector.nonzero(FDConvert(fname))
- *
- * def __neg__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](self.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4354,29 +4676,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__neg__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":104
+ /* "cdec/vectors.pxi":104
*
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":105
+ /* "cdec/vectors.pxi":105
* def __neg__(self):
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<<
* result.vector[0] *= -1.0
* return result
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>((__pyx_v_self->vector[0]));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> ((__pyx_v_self->vector[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":106
+ /* "cdec/vectors.pxi":106
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0 # <<<<<<<<<<<<<<
@@ -4385,7 +4707,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
*/
(__pyx_v_result->vector[0]) *= -1.0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":107
+ /* "cdec/vectors.pxi":107
* result.vector = new FastSparseVector[weight_t](self.vector[0])
* result.vector[0] *= -1.0
* return result # <<<<<<<<<<<<<<
@@ -4397,8 +4719,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":103
+ * return self.vector.nonzero(FDConvert(fname))
+ *
+ * def __neg__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](self.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4410,6 +4739,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/vectors.pxi":109
+ * return result
+ *
+ * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] += other.vector[0]
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
@@ -4421,6 +4758,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4429,20 +4768,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":109
- * return result
- *
- * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
- * self.vector[0] += other.vector[0]
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":110
+ /* "cdec/vectors.pxi":110
*
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0] # <<<<<<<<<<<<<<
@@ -4451,7 +4782,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":111
+ /* "cdec/vectors.pxi":111
* def __iadd__(SparseVector self, SparseVector other):
* self.vector[0] += other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4463,13 +4794,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_23__iadd__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/vectors.pxi":109
+ * return result
+ *
+ * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] += other.vector[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":113
+ * return self
+ *
+ * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] -= other.vector[0]
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
@@ -4481,6 +4828,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx
__Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "other", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4489,20 +4838,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__(PyObject *__pyx
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":113
- * return self
- *
- * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
- * self.vector[0] -= other.vector[0]
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__isub__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":114
+ /* "cdec/vectors.pxi":114
*
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<<
@@ -4511,7 +4852,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":115
+ /* "cdec/vectors.pxi":115
* def __isub__(SparseVector self, SparseVector other):
* self.vector[0] -= other.vector[0]
* return self # <<<<<<<<<<<<<<
@@ -4523,13 +4864,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_25__isub__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/vectors.pxi":113
+ * return self
+ *
+ * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<<
+ * self.vector[0] -= other.vector[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":117
+ * return self
+ *
+ * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] *= scalar
+ * return self
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) {
@@ -4550,24 +4907,18 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__(PyObject *__pyx
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":117
- * return self
- *
- * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
- * self.vector[0] *= scalar
- * return self
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__imul__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":118
+ /* "cdec/vectors.pxi":118
*
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar # <<<<<<<<<<<<<<
@@ -4576,7 +4927,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) *= __pyx_v_scalar;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":119
+ /* "cdec/vectors.pxi":119
* def __imul__(SparseVector self, float scalar):
* self.vector[0] *= scalar
* return self # <<<<<<<<<<<<<<
@@ -4588,13 +4939,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/vectors.pxi":117
+ * return self
+ *
+ * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] *= scalar
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/vectors.pxi":121
+ * return self
+ *
+ * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] /= scalar
+ * return self
+ */
+
/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/
@@ -4616,26 +4983,20 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":121
- * return self
- *
- * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
- * self.vector[0] /= scalar
- * return self
- */
-
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__idiv__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":122
+ /* "cdec/vectors.pxi":122
*
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar # <<<<<<<<<<<<<<
@@ -4644,7 +5005,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
*/
(__pyx_v_self->vector[0]) /= __pyx_v_scalar;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":123
+ /* "cdec/vectors.pxi":123
* def __idiv__(SparseVector self, float scalar):
* self.vector[0] /= scalar
* return self # <<<<<<<<<<<<<<
@@ -4656,7 +5017,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/vectors.pxi":121
+ * return self
+ *
+ * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<<
+ * self.vector[0] /= scalar
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -4664,6 +5033,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_ob
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+/* "cdec/vectors.pxi":125
+ * return self
+ *
+ * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4676,6 +5053,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4684,14 +5063,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_32__add__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":125
- * return self
- *
- * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4702,29 +5073,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":126
+ /* "cdec/vectors.pxi":126
*
* def __add__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":127
+ /* "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]) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":128
+ /* "cdec/vectors.pxi":128
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4736,8 +5107,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":125
+ * return self
+ *
+ * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4749,6 +5127,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_31__add__(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/vectors.pxi":130
+ * return result
+ *
+ * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4761,6 +5147,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "x", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_SparseVector, 1, "y", 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_y));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -4769,14 +5157,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":130
- * return result
- *
- * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
- * cdef SparseVector result = SparseVector.__new__(SparseVector)
- * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
@@ -4787,29 +5167,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__sub__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":131
+ /* "cdec/vectors.pxi":131
*
* def __sub__(SparseVector x, SparseVector y):
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":132
+ /* "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]) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":133
+ /* "cdec/vectors.pxi":133
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
* return result # <<<<<<<<<<<<<<
@@ -4821,8 +5201,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":130
+ * return result
+ *
+ * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<<
+ * cdef SparseVector result = SparseVector.__new__(SparseVector)
+ * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4834,6 +5221,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_33__sub__(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/vectors.pxi":135
+ * return result
+ *
+ * def __mul__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
@@ -4841,18 +5236,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":135
- * return result
- *
- * def __mul__(x, y): # <<<<<<<<<<<<<<
- * cdef SparseVector vector
- * cdef float scalar
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
float __pyx_v_scalar;
@@ -4868,7 +5257,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__mul__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":138
+ /* "cdec/vectors.pxi":138
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -4889,7 +5278,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":139
+ /* "cdec/vectors.pxi":139
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -4906,29 +5295,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":140
+ /* "cdec/vectors.pxi":140
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result
*/
- __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":141
+ /* "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) # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_vector->vector[0]) * __pyx_v_scalar));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":142
+ /* "cdec/vectors.pxi":142
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar)
* return result # <<<<<<<<<<<<<<
@@ -4940,8 +5329,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":135
+ * return result
+ *
+ * def __mul__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -4954,6 +5350,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_
return __pyx_r;
}
+/* "cdec/vectors.pxi":144
+ * return result
+ *
+ * def __div__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
@@ -4962,19 +5366,13 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":144
- * return result
- *
- * def __div__(x, y): # <<<<<<<<<<<<<<
- * cdef SparseVector vector
- * cdef float scalar
- */
-
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
@@ -4991,7 +5389,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__div__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":147
+ /* "cdec/vectors.pxi":147
* cdef SparseVector vector
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<<
@@ -5012,7 +5410,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":148
+ /* "cdec/vectors.pxi":148
* cdef float scalar
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x # <<<<<<<<<<<<<<
@@ -5029,28 +5427,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":149
+ /* "cdec/vectors.pxi":149
* if isinstance(x, SparseVector): vector, scalar = x, y
* else: vector, scalar = y, x
* cdef SparseVector result = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result
*/
- __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":150
+ /* "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) # <<<<<<<<<<<<<<
* return result
*/
- __pyx_v_result->vector = new FastSparseVector<weight_t>(((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
+ __pyx_v_result->vector = new FastSparseVector<weight_t> (((__pyx_v_vector->vector[0]) / __pyx_v_scalar));
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":151
+ /* "cdec/vectors.pxi":151
* cdef SparseVector result = SparseVector.__new__(SparseVector)
* result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar)
* return result # <<<<<<<<<<<<<<
@@ -5060,8 +5458,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/vectors.pxi":144
+ * return result
+ *
+ * def __div__(x, y): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector
+ * cdef float scalar
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5075,20 +5480,30 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
+/* "cdec/grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_1_phrase = {__Pyx_NAMESTR("_phrase"), (PyCFunction)__pyx_pw_4cdec_5_cdec_1_phrase, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_1_phrase = {"_phrase", (PyCFunction)__pyx_pw_4cdec_5_cdec_1_phrase, METH_O, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_phrase (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+/* "cdec/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -5114,25 +5529,23 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) {
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7_phrase_2generator21, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7_phrase_2generator22, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_phrase_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec._phrase.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -5158,34 +5571,37 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) { __Pyx_RaiseClosureNameError("phrase"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -5193,15 +5609,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_w);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_w);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_w, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- __pyx_cur_scope->__pyx_v_w = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_t_5 = PyUnicode_Check(__pyx_cur_scope->__pyx_v_w);
if ((__pyx_t_5 != 0)) {
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s__encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_w, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_4 = __pyx_t_7;
@@ -5212,9 +5627,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_w);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_w);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_w);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_4 = __pyx_t_6;
__pyx_t_6 = 0;
}
@@ -5238,6 +5653,8 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -5254,7 +5671,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator21(__pyx_GeneratorObje
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
+/* "cdec/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
@@ -5268,7 +5685,6 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -5283,7 +5699,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+ /* "cdec/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
@@ -5291,29 +5707,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
* cdef class NT:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_4cdec_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":5
+ * import cdec.sa._sa as _sa
+ *
+ * def _phrase(phrase): # <<<<<<<<<<<<<<
+ * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec._phrase", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -5323,6 +5737,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_sel
return __pyx_r;
}
+/* "cdec/grammar.pxi":11
+ * cdef public bytes cat
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ * self.cat = cat
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_2NT___init__[] = "NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.";
@@ -5339,7 +5761,7 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cat,&__pyx_n_s__ref,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cat,&__pyx_n_s_ref,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -5353,11 +5775,11 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cat)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cat)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ref);
if (value) { values[1] = value; kw_args--; }
}
}
@@ -5374,7 +5796,7 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
}
__pyx_v_cat = ((PyObject*)values[0]);
if (values[1]) {
- __pyx_v_ref = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_ref = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_ref = ((unsigned int)0);
}
@@ -5389,6 +5811,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cat), (&PyBytes_Type), 1, "cat", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT___init__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), __pyx_v_cat, __pyx_v_ref);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -5397,33 +5821,25 @@ static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":11
- * cdef public bytes cat
- * cdef public unsigned ref
- * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
- * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
- * self.cat = cat
- */
-
static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_cat, unsigned int __pyx_v_ref) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":13
+ /* "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 # <<<<<<<<<<<<<<
* self.ref = ref
*
*/
- __Pyx_INCREF(((PyObject *)__pyx_v_cat));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_cat));
+ __Pyx_INCREF(__pyx_v_cat);
+ __Pyx_GIVEREF(__pyx_v_cat);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_DECREF(__pyx_v_self->cat);
__pyx_v_self->cat = __pyx_v_cat;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":14
+ /* "cdec/grammar.pxi":14
* """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
* self.cat = cat
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5432,11 +5848,28 @@ static int __pyx_pf_4cdec_5_cdec_2NT___init__(struct __pyx_obj_4cdec_5_cdec_NT *
*/
__pyx_v_self->ref = __pyx_v_ref;
+ /* "cdec/grammar.pxi":11
+ * cdef public bytes cat
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<<
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ * self.cat = cat
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/grammar.pxi":16
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * if self.ref > 0:
+ * return '[%s,%d]' % (self.cat, self.ref)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
@@ -5444,18 +5877,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_2__str__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":16
- * self.ref = ref
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * if self.ref > 0:
- * return '[%s,%d]' % (self.cat, self.ref)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5467,7 +5894,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":17
+ /* "cdec/grammar.pxi":17
*
* def __str__(self):
* if self.ref > 0: # <<<<<<<<<<<<<<
@@ -5477,7 +5904,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":18
+ /* "cdec/grammar.pxi":18
* def __str__(self):
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<<
@@ -5485,27 +5912,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->cat));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->cat));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_INCREF(__pyx_v_self->cat);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self->cat);
+ __Pyx_GIVEREF(__pyx_v_self->cat);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_d, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":19
+ /* "cdec/grammar.pxi":19
* if self.ref > 0:
* return '[%s,%d]' % (self.cat, self.ref)
* return '[%s]' % self.cat # <<<<<<<<<<<<<<
@@ -5513,14 +5938,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
* cdef class NTRef:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_v_self->cat)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_self->cat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":16
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * if self.ref > 0:
+ * return '[%s,%d]' % (self.cat, self.ref)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
@@ -5532,6 +5964,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "cdec/grammar.pxi":9
+ *
+ * cdef class NT:
+ * cdef public bytes cat # <<<<<<<<<<<<<<
+ * cdef public unsigned ref
+ * def __init__(self, bytes cat, unsigned ref=0):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) {
@@ -5539,28 +5979,22 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":9
- *
- * cdef class NT:
- * cdef public bytes cat # <<<<<<<<<<<<<<
- * cdef public unsigned ref
- * def __init__(self, bytes cat, unsigned ref=0):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3cat___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->cat));
- __pyx_r = ((PyObject *)__pyx_v_self->cat);
+ __Pyx_INCREF(__pyx_v_self->cat);
+ __pyx_r = __pyx_v_self->cat;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -5574,6 +6008,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat_2__set__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5581,20 +6017,25 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObj
static int __pyx_pf_4cdec_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
+ if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
- __pyx_v_self->cat = ((PyObject*)__pyx_v_value);
+ __Pyx_DECREF(__pyx_v_self->cat);
+ __pyx_v_self->cat = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NT.cat.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -5609,6 +6050,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5620,14 +6063,23 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_4cdec_5_cdec
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->cat);
- __Pyx_DECREF(((PyObject *)__pyx_v_self->cat));
+ __Pyx_DECREF(__pyx_v_self->cat);
__pyx_v_self->cat = ((PyObject*)Py_None);
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/grammar.pxi":10
+ * cdef class NT:
+ * cdef public bytes cat
+ * cdef public unsigned ref # <<<<<<<<<<<<<<
+ * def __init__(self, bytes cat, unsigned ref=0):
+ * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) {
@@ -5635,18 +6087,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":10
- * cdef class NT:
- * cdef public bytes cat
- * cdef public unsigned ref # <<<<<<<<<<<<<<
- * def __init__(self, bytes cat, unsigned ref=0):
- * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5656,14 +6102,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3ref___get__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __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;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NT.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5681,6 +6126,8 @@ static int __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5693,9 +6140,10 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ref = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -5706,6 +6154,14 @@ static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "cdec/grammar.pxi":23
+ * cdef class NTRef:
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
+ * """NTRef(int ref) -> Non-terminal reference."""
+ * self.ref = ref
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5NTRef___init__[] = "NTRef(int ref) -> Non-terminal reference.";
@@ -5721,7 +6177,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ref,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -5734,7 +6190,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ref)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -5745,7 +6201,7 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
- __pyx_v_ref = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_ref = __Pyx_PyInt_As_unsigned_int(values[0]); if (unlikely((__pyx_v_ref == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
@@ -5756,24 +6212,18 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef___init__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self), __pyx_v_ref);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":23
- * cdef class NTRef:
- * cdef public unsigned ref
- * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
- * """NTRef(int ref) -> Non-terminal reference."""
- * self.ref = ref
- */
-
static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self, unsigned int __pyx_v_ref) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":25
+ /* "cdec/grammar.pxi":25
* def __init__(self, unsigned ref):
* """NTRef(int ref) -> Non-terminal reference."""
* self.ref = ref # <<<<<<<<<<<<<<
@@ -5782,11 +6232,28 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_N
*/
__pyx_v_self->ref = __pyx_v_ref;
+ /* "cdec/grammar.pxi":23
+ * cdef class NTRef:
+ * cdef public unsigned ref
+ * def __init__(self, unsigned ref): # <<<<<<<<<<<<<<
+ * """NTRef(int ref) -> Non-terminal reference."""
+ * self.ref = ref
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/grammar.pxi":27
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return '[%d]' % self.ref
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
@@ -5794,18 +6261,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_2__str__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":27
- * self.ref = ref
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return '[%d]' % self.ref
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5816,7 +6277,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":28
+ /* "cdec/grammar.pxi":28
*
* def __str__(self):
* return '[%d]' % self.ref # <<<<<<<<<<<<<<
@@ -5824,17 +6285,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
* cdef TRule convert_rule(_sa.Rule rule):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
+ __pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":27
+ * self.ref = ref
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return '[%d]' % self.ref
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -5846,6 +6314,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "cdec/grammar.pxi":22
+ *
+ * cdef class NTRef:
+ * cdef public unsigned ref # <<<<<<<<<<<<<<
+ * def __init__(self, unsigned ref):
+ * """NTRef(int ref) -> Non-terminal reference."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) {
@@ -5853,18 +6329,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":22
- *
- * cdef class NTRef:
- * cdef public unsigned ref # <<<<<<<<<<<<<<
- * def __init__(self, unsigned ref):
- * """NTRef(int ref) -> Non-terminal reference."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -5874,14 +6344,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __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;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.NTRef.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -5899,6 +6368,8 @@ static int __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -5911,9 +6382,10 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_c
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ref = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -5924,7 +6396,7 @@ static int __pyx_pf_4cdec_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_4cdec_5_c
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":30
+/* "cdec/grammar.pxi":30
* return '[%d]' % self.ref
*
* cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
@@ -5950,12 +6422,13 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_rule", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":31
+ /* "cdec/grammar.pxi":31
*
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<<
@@ -5964,7 +6437,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":32
+ /* "cdec/grammar.pxi":32
* cdef TRule convert_rule(_sa.Rule rule):
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores) # <<<<<<<<<<<<<<
@@ -5976,13 +6449,13 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
__Pyx_INCREF(((PyObject *)__pyx_v_rule->scores));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_rule->scores));
__Pyx_GIVEREF(((PyObject *)__pyx_v_rule->scores));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_scores = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":33
+ /* "cdec/grammar.pxi":33
* lhs = _sa.sym_tocat(rule.lhs)
* scores = dict(rule.scores)
* f, e = [], [] # <<<<<<<<<<<<<<
@@ -5998,7 +6471,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":34
+ /* "cdec/grammar.pxi":34
* scores = dict(rule.scores)
* f, e = [], []
* cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<<
@@ -6008,7 +6481,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":35
+ /* "cdec/grammar.pxi":35
* f, e = [], []
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n): # <<<<<<<<<<<<<<
@@ -6019,7 +6492,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":36
+ /* "cdec/grammar.pxi":36
* cdef int* fsyms = rule.f.syms
* for i in range(rule.f.n):
* if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<<
@@ -6029,7 +6502,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":37
+ /* "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]))) # <<<<<<<<<<<<<<
@@ -6037,22 +6510,22 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* f.append(_sa.sym_tostring(fsyms[i]))
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tocat((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":39
+ /* "cdec/grammar.pxi":39
* f.append(NT(_sa.sym_tocat(fsyms[i])))
* else:
* f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<<
@@ -6060,14 +6533,14 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* for i in range(rule.e.n):
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_fsyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_f, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":40
+ /* "cdec/grammar.pxi":40
* else:
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<<
@@ -6077,7 +6550,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":41
+ /* "cdec/grammar.pxi":41
* f.append(_sa.sym_tostring(fsyms[i]))
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n): # <<<<<<<<<<<<<<
@@ -6088,7 +6561,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":42
+ /* "cdec/grammar.pxi":42
* cdef int* esyms = rule.e.syms
* for i in range(rule.e.n):
* if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<<
@@ -6098,30 +6571,30 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":43
+ /* "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]))) # <<<<<<<<<<<<<<
* else:
* e.append(_sa.sym_tostring(esyms[i]))
*/
- __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L8;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":45
+ /* "cdec/grammar.pxi":45
* e.append(NTRef(_sa.sym_getindex(esyms[i])))
* else:
* e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<<
@@ -6129,37 +6602,52 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* return TRule(lhs, f, e, scores, a)
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring((__pyx_v_esyms[__pyx_v_i]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_e, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L8:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":46
+ /* "cdec/grammar.pxi":46
* else:
* e.append(_sa.sym_tostring(esyms[i]))
* a = list(rule.alignments()) # <<<<<<<<<<<<<<
* return TRule(lhs, f, e, scores, a)
*
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rule), __pyx_n_s__alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rule), __pyx_n_s_alignments); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_8) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_v_a = ((PyObject*)__pyx_t_2);
- __pyx_t_2 = 0;
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_a = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":47
+ /* "cdec/grammar.pxi":47
* e.append(_sa.sym_tostring(esyms[i]))
* a = list(rule.alignments())
* return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<<
@@ -6167,37 +6655,45 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
* cdef class TRule:
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(((PyObject *)__pyx_v_f));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_f));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_f));
- __Pyx_INCREF(((PyObject *)__pyx_v_e));
- PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_e));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e));
- __Pyx_INCREF(((PyObject *)__pyx_v_scores));
- PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_scores));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_scores));
- __Pyx_INCREF(((PyObject *)__pyx_v_a));
- PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_a));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_a));
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_2);
- __pyx_t_2 = 0;
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_f);
+ __Pyx_GIVEREF(__pyx_v_f);
+ __Pyx_INCREF(__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_e);
+ __Pyx_GIVEREF(__pyx_v_e);
+ __Pyx_INCREF(__pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_scores);
+ __Pyx_GIVEREF(__pyx_v_scores);
+ __Pyx_INCREF(__pyx_v_a);
+ PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_a);
+ __Pyx_GIVEREF(__pyx_v_a);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":30
+ * return '[%d]' % self.ref
+ *
+ * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<<
+ * lhs = _sa.sym_tocat(rule.lhs)
+ * scores = dict(rule.scores)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("cdec._cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -6210,6 +6706,14 @@ static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(st
return __pyx_r;
}
+/* "cdec/grammar.pxi":52
+ * cdef shared_ptr[grammar.TRule]* rule
+ *
+ * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
+ * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
+ * lhs: left hand side non-terminal
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5TRule___init__[] = "TRule(lhs, f, e, scores, a=None) -> Translation rule.\n lhs: left hand side non-terminal\n f: source phrase (list of words/NT)\n e: target phrase (list of words/NTRef)\n scores: dictionary of feature scores\n a: optional list of alignment points";
@@ -6230,16 +6734,8 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,&__pyx_n_s__text,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_f,&__pyx_n_s_e,&__pyx_n_s_scores,&__pyx_n_s_a,&__pyx_n_s_text,0};
PyObject* values[6] = {0,0,0,0,0,0};
-
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":52
- * cdef shared_ptr[grammar.TRule]* rule
- *
- * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
- * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
- * lhs: left hand side non-terminal
- */
values[4] = ((PyObject *)Py_None);
values[5] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
@@ -6258,31 +6754,31 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
- if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
+ if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 6, 3); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a);
if (value) { values[4] = value; kw_args--; }
}
case 5:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_text);
if (value) { values[5] = value; kw_args--; }
}
}
@@ -6317,6 +6813,8 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule___init__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_a, __pyx_v_text);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -6332,7 +6830,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":59
+ /* "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()) # <<<<<<<<<<<<<<
@@ -6345,9 +6843,9 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_self->rule = new boost::shared_ptr<TRule>(__pyx_t_1);
+ __pyx_v_self->rule = new boost::shared_ptr<TRule> (__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":60
+ /* "cdec/grammar.pxi":60
* a: optional list of alignment points"""
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* if lhs: # <<<<<<<<<<<<<<
@@ -6357,19 +6855,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_lhs); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":61
+ /* "cdec/grammar.pxi":61
* self.rule = new shared_ptr[grammar.TRule](new grammar.TRule())
* if lhs:
* self.lhs = lhs # <<<<<<<<<<<<<<
* if e:
* self.e = e
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":62
+ /* "cdec/grammar.pxi":62
* if lhs:
* self.lhs = lhs
* if e: # <<<<<<<<<<<<<<
@@ -6379,19 +6877,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_e); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":63
+ /* "cdec/grammar.pxi":63
* self.lhs = lhs
* if e:
* self.e = e # <<<<<<<<<<<<<<
* if f:
* self.f = f
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":64
+ /* "cdec/grammar.pxi":64
* if e:
* self.e = e
* if f: # <<<<<<<<<<<<<<
@@ -6401,19 +6899,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_f); 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":65
+ /* "cdec/grammar.pxi":65
* self.e = e
* if f:
* self.f = f # <<<<<<<<<<<<<<
* if scores:
* self.scores = scores
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":66
+ /* "cdec/grammar.pxi":66
* if f:
* self.f = f
* if scores: # <<<<<<<<<<<<<<
@@ -6423,19 +6921,19 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_scores); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":67
+ /* "cdec/grammar.pxi":67
* self.f = f
* if scores:
* self.scores = scores # <<<<<<<<<<<<<<
* if a:
* self.a = a
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":68
+ /* "cdec/grammar.pxi":68
* if scores:
* self.scores = scores
* if a: # <<<<<<<<<<<<<<
@@ -6445,19 +6943,19 @@ 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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":69
+ /* "cdec/grammar.pxi":69
* self.scores = scores
* if a:
* self.a = a # <<<<<<<<<<<<<<
* if text:
* self.rule.get().ReadFromString(text, 0)
*/
- if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_a, __pyx_v_a) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":70
+ /* "cdec/grammar.pxi":70
* if a:
* self.a = a
* if text: # <<<<<<<<<<<<<<
@@ -6467,7 +6965,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_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":71
+ /* "cdec/grammar.pxi":71
* self.a = a
* if text:
* self.rule.get().ReadFromString(text, 0) # <<<<<<<<<<<<<<
@@ -6480,7 +6978,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
}
__pyx_L8:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":72
+ /* "cdec/grammar.pxi":72
* if text:
* self.rule.get().ReadFromString(text, 0)
* self.rule.get().ComputeArity() # <<<<<<<<<<<<<<
@@ -6489,6 +6987,15 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
*/
__pyx_v_self->rule->get()->ComputeArity();
+ /* "cdec/grammar.pxi":52
+ * cdef shared_ptr[grammar.TRule]* rule
+ *
+ * def __init__(self, lhs, f, e, scores, a=None, text=None): # <<<<<<<<<<<<<<
+ * """TRule(lhs, f, e, scores, a=None) -> Translation rule.
+ * lhs: left hand side non-terminal
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -6499,28 +7006,30 @@ static int __pyx_pf_4cdec_5_cdec_5TRule___init__(struct __pyx_obj_4cdec_5_cdec_T
return __pyx_r;
}
+/* "cdec/grammar.pxi":74
+ * self.rule.get().ComputeArity()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.rule
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":74
- * self.rule.get().ComputeArity()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.rule
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":75
+ /* "cdec/grammar.pxi":75
*
* def __dealloc__(self):
* del self.rule # <<<<<<<<<<<<<<
@@ -6529,9 +7038,26 @@ static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx
*/
delete __pyx_v_self->rule;
+ /* "cdec/grammar.pxi":74
+ * self.rule.get().ComputeArity()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.rule
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/grammar.pxi":78
+ *
+ * property arity:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.rule.get().arity_
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) {
@@ -6539,18 +7065,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":78
- *
- * property arity:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.rule.get().arity_
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -6560,7 +7080,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":79
+ /* "cdec/grammar.pxi":79
* property arity:
* def __get__(self):
* return self.rule.get().arity_ # <<<<<<<<<<<<<<
@@ -6568,14 +7088,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
* property f:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->rule->get()->arity_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __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;
+ /* "cdec/grammar.pxi":78
+ *
+ * property arity:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.rule.get().arity_
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -6586,6 +7113,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(struct __pyx_obj_4c
return __pyx_r;
}
+/* "cdec/grammar.pxi":82
+ *
+ * property f:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * cdef WordID w
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) {
@@ -6593,20 +7128,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1f___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":82
- *
- * property f:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* f_ = &self.rule.get().f_
- * cdef WordID w
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
- std::vector<WordID> *__pyx_v_f_;
+ std::vector<WordID> *__pyx_v_f_;
WordID __pyx_v_w;
PyObject *__pyx_v_f = 0;
unsigned int __pyx_v_i;
@@ -6619,12 +7148,13 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":83
+ /* "cdec/grammar.pxi":83
* property f:
* def __get__(self):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6633,7 +7163,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_f_ = (&__pyx_v_self->rule->get()->f_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":85
+ /* "cdec/grammar.pxi":85
* cdef vector[WordID]* f_ = &self.rule.get().f_
* cdef WordID w
* cdef f = [] # <<<<<<<<<<<<<<
@@ -6642,10 +7172,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_v_f = ((PyObject *)__pyx_t_1);
+ __pyx_v_f = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":87
+ /* "cdec/grammar.pxi":87
* cdef f = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6654,7 +7184,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":88
+ /* "cdec/grammar.pxi":88
* cdef unsigned i
* cdef int idx = 0
* for i in range(f_.size()): # <<<<<<<<<<<<<<
@@ -6665,7 +7195,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":89
+ /* "cdec/grammar.pxi":89
* cdef int idx = 0
* for i in range(f_.size()):
* w = f_[0][i] # <<<<<<<<<<<<<<
@@ -6674,7 +7204,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]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":90
+ /* "cdec/grammar.pxi":90
* for i in range(f_.size()):
* w = f_[0][i]
* if w < 0: # <<<<<<<<<<<<<<
@@ -6684,7 +7214,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":91
+ /* "cdec/grammar.pxi":91
* w = f_[0][i]
* if w < 0:
* idx += 1 # <<<<<<<<<<<<<<
@@ -6693,7 +7223,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":92
+ /* "cdec/grammar.pxi":92
* if w < 0:
* idx += 1
* f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<<
@@ -6701,58 +7231,54 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_w)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_1 = 0;
__pyx_t_5 = 0;
- __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_5); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":94
+ /* "cdec/grammar.pxi":94
* f.append(NT(TDConvert(-w).c_str(), idx))
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return f
*
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_f, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":95
+ /* "cdec/grammar.pxi":95
* else:
* f.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return f # <<<<<<<<<<<<<<
@@ -6764,8 +7290,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_f;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":82
+ *
+ * property f:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * cdef WordID w
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
@@ -6779,6 +7312,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/grammar.pxi":97
+ * return f
+ *
+ * def __set__(self, f): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * f_.resize(len(f))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
@@ -6786,20 +7327,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_f));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":97
- * return f
- *
- * def __set__(self, f): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* f_ = &self.rule.get().f_
- * f_.resize(len(f))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f) {
- std::vector<WordID> *__pyx_v_f_;
+ std::vector<WordID> *__pyx_v_f_;
unsigned int __pyx_v_i;
CYTHON_UNUSED int __pyx_v_idx;
PyObject *__pyx_v_fi = NULL;
@@ -6817,7 +7352,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":98
+ /* "cdec/grammar.pxi":98
*
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<<
@@ -6826,7 +7361,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_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":99
+ /* "cdec/grammar.pxi":99
* def __set__(self, f):
* cdef vector[WordID]* f_ = &self.rule.get().f_
* f_.resize(len(f)) # <<<<<<<<<<<<<<
@@ -6836,7 +7371,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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":101
+ /* "cdec/grammar.pxi":101
* f_.resize(len(f))
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6845,7 +7380,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":102
+ /* "cdec/grammar.pxi":102
* cdef unsigned i
* cdef int idx = 0
* for i in range(len(f)): # <<<<<<<<<<<<<<
@@ -6856,65 +7391,73 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":103
+ /* "cdec/grammar.pxi":103
* cdef int idx = 0
* for i in range(len(f)):
* if isinstance(f[i], NT): # <<<<<<<<<<<<<<
* f_[0][i] = -TDConvert((<NT> f[i]).cat)
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NT));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = (__pyx_t_4 != 0);
if (__pyx_t_5) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":104
+ /* "cdec/grammar.pxi":104
* for i in range(len(f)):
* if isinstance(f[i], NT):
* f_[0][i] = -TDConvert((<NT> f[i]).cat) # <<<<<<<<<<<<<<
* else:
* fi = as_str(f[i])
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_6 = __Pyx_PyObject_AsString(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_t_3)->cat); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_6));
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":106
+ /* "cdec/grammar.pxi":106
* f_[0][i] = -TDConvert((<NT> f[i]).cat)
* else:
* fi = as_str(f[i]) # <<<<<<<<<<<<<<
* f_[0][i] = TDConvert(fi)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_f, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF(((PyObject *)__pyx_v_fi));
- __pyx_v_fi = ((PyObject*)__pyx_t_7);
+ __Pyx_XDECREF_SET(__pyx_v_fi, ((PyObject*)__pyx_t_7));
__pyx_t_7 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":107
+ /* "cdec/grammar.pxi":107
* else:
* fi = as_str(f[i])
* f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<<
*
* property e:
*/
- __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fi)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_fi); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_f_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_6);
}
__pyx_L5:;
}
+ /* "cdec/grammar.pxi":97
+ * return f
+ *
+ * def __set__(self, f): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* f_ = &self.rule.get().f_
+ * f_.resize(len(f))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -6928,6 +7471,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "cdec/grammar.pxi":110
+ *
+ * property e:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * cdef WordID w
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) {
@@ -6935,20 +7486,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1e___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":110
- *
- * property e:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* e_ = &self.rule.get().e_
- * cdef WordID w
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
- std::vector<WordID> *__pyx_v_e_;
+ std::vector<WordID> *__pyx_v_e_;
WordID __pyx_v_w;
PyObject *__pyx_v_e = 0;
unsigned int __pyx_v_i;
@@ -6960,13 +7505,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
unsigned int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":111
+ /* "cdec/grammar.pxi":111
* property e:
* def __get__(self):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -6975,7 +7521,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_e_ = (&__pyx_v_self->rule->get()->e_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":113
+ /* "cdec/grammar.pxi":113
* cdef vector[WordID]* e_ = &self.rule.get().e_
* cdef WordID w
* cdef e = [] # <<<<<<<<<<<<<<
@@ -6984,10 +7530,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_v_e = ((PyObject *)__pyx_t_1);
+ __pyx_v_e = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":115
+ /* "cdec/grammar.pxi":115
* cdef e = []
* cdef unsigned i
* cdef int idx = 0 # <<<<<<<<<<<<<<
@@ -6996,7 +7542,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":116
+ /* "cdec/grammar.pxi":116
* cdef unsigned i
* cdef int idx = 0
* for i in range(e_.size()): # <<<<<<<<<<<<<<
@@ -7007,7 +7553,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":117
+ /* "cdec/grammar.pxi":117
* cdef int idx = 0
* for i in range(e_.size()):
* w = e_[0][i] # <<<<<<<<<<<<<<
@@ -7016,7 +7562,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]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":118
+ /* "cdec/grammar.pxi":118
* for i in range(e_.size()):
* w = e_[0][i]
* if w < 1: # <<<<<<<<<<<<<<
@@ -7026,7 +7572,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":119
+ /* "cdec/grammar.pxi":119
* w = e_[0][i]
* if w < 1:
* idx += 1 # <<<<<<<<<<<<<<
@@ -7035,61 +7581,57 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
*/
__pyx_v_idx = (__pyx_v_idx + 1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":120
+ /* "cdec/grammar.pxi":120
* if w < 1:
* idx += 1
* e.append(NTRef(1-w)) # <<<<<<<<<<<<<<
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
*/
- __pyx_t_1 = PyInt_FromLong((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_long((1 - __pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":122
+ /* "cdec/grammar.pxi":122
* e.append(NTRef(1-w))
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<<
* return e
*
*/
- __pyx_t_5 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_w).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
- __pyx_t_5 = 0;
- __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_e, __pyx_t_7); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__pyx_L5:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":123
+ /* "cdec/grammar.pxi":123
* else:
* e.append(unicode(TDConvert(w).c_str(), encoding='utf8'))
* return e # <<<<<<<<<<<<<<
@@ -7101,12 +7643,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_e;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":110
+ *
+ * property e:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * cdef WordID w
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -7116,6 +7665,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/grammar.pxi":125
+ * return e
+ *
+ * def __set__(self, e): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * e_.resize(len(e))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e) {
@@ -7123,20 +7680,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_e));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":125
- * return e
- *
- * def __set__(self, e): # <<<<<<<<<<<<<<
- * cdef vector[WordID]* e_ = &self.rule.get().e_
- * e_.resize(len(e))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_e) {
- std::vector<WordID> *__pyx_v_e_;
+ std::vector<WordID> *__pyx_v_e_;
unsigned int __pyx_v_i;
PyObject *__pyx_v_ei = NULL;
int __pyx_r;
@@ -7154,7 +7705,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":126
+ /* "cdec/grammar.pxi":126
*
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<<
@@ -7163,7 +7714,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_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":127
+ /* "cdec/grammar.pxi":127
* def __set__(self, e):
* cdef vector[WordID]* e_ = &self.rule.get().e_
* e_.resize(len(e)) # <<<<<<<<<<<<<<
@@ -7173,7 +7724,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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_e_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":129
+ /* "cdec/grammar.pxi":129
* e_.resize(len(e))
* cdef unsigned i
* for i in range(len(e)): # <<<<<<<<<<<<<<
@@ -7184,71 +7735,79 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":130
+ /* "cdec/grammar.pxi":130
* cdef unsigned i
* for i in range(len(e)):
* if isinstance(e[i], NTRef): # <<<<<<<<<<<<<<
* e_[0][i] = 1-e[i].ref
* else:
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = (__pyx_t_4 != 0);
if (__pyx_t_5) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":131
+ /* "cdec/grammar.pxi":131
* for i in range(len(e)):
* if isinstance(e[i], NTRef):
* e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<<
* else:
* ei = as_str(e[i])
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__ref); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ref); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_7 = __Pyx_PyInt_from_py_WordID(__pyx_t_3); if (unlikely((__pyx_t_7 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_As_WordID(__pyx_t_3); if (unlikely((__pyx_t_7 == (WordID)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
((__pyx_v_e_[0])[__pyx_v_i]) = __pyx_t_7;
goto __pyx_L5;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":133
+ /* "cdec/grammar.pxi":133
* e_[0][i] = 1-e[i].ref
* else:
* ei = as_str(e[i]) # <<<<<<<<<<<<<<
* e_[0][i] = TDConvert(ei)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_e, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF(((PyObject *)__pyx_v_ei));
- __pyx_v_ei = ((PyObject*)__pyx_t_6);
+ __Pyx_XDECREF_SET(__pyx_v_ei, ((PyObject*)__pyx_t_6));
__pyx_t_6 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":134
+ /* "cdec/grammar.pxi":134
* else:
* ei = as_str(e[i])
* e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<<
*
* property a:
*/
- __pyx_t_8 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_ei)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_ei); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((__pyx_v_e_[0])[__pyx_v_i]) = TD::Convert(__pyx_t_8);
}
__pyx_L5:;
}
+ /* "cdec/grammar.pxi":125
+ * return e
+ *
+ * def __set__(self, e): # <<<<<<<<<<<<<<
+ * cdef vector[WordID]* e_ = &self.rule.get().e_
+ * e_.resize(len(e))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -7263,6 +7822,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_4cdec_5_cde
}
static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/grammar.pxi":137
+ *
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) {
@@ -7270,18 +7837,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1a___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":137
- *
- * property a:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1a___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -7300,18 +7861,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1a___get__(struct __pyx_obj_4cdec_
__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_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_TRule___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.TRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -7342,7 +7901,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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":139
+ /* "cdec/grammar.pxi":139
* def __get__(self):
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -7351,7 +7910,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_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":140
+ /* "cdec/grammar.pxi":140
* cdef unsigned i
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()): # <<<<<<<<<<<<<<
@@ -7362,16 +7921,16 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":141
+ /* "cdec/grammar.pxi":141
* cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
* for i in range(a.size()):
* yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<<
*
* def __set__(self, a):
*/
- __pyx_t_3 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_short(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).s_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyInt_FromLong(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_short(((__pyx_cur_scope->__pyx_v_a[0])[__pyx_cur_scope->__pyx_v_i]).t_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
@@ -7381,7 +7940,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -7395,6 +7954,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/grammar.pxi":137
+ *
+ * property a:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -7410,6 +7979,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObje
return NULL;
}
+/* "cdec/grammar.pxi":143
+ * yield (a[0][i].s_, a[0][i].t_)
+ *
+ * def __set__(self, a): # <<<<<<<<<<<<<<
+ * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
+ * a_.resize(len(a))
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a) {
@@ -7417,20 +7994,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_a));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":143
- * yield (a[0][i].s_, a[0][i].t_)
- *
- * def __set__(self, a): # <<<<<<<<<<<<<<
- * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
- * a_.resize(len(a))
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_a) {
- std::vector<AlignmentPoint> *__pyx_v_a_;
+ std::vector<AlignmentPoint> *__pyx_v_a_;
unsigned int __pyx_v_i;
int __pyx_v_s;
int __pyx_v_t;
@@ -7450,7 +8021,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":144
+ /* "cdec/grammar.pxi":144
*
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<<
@@ -7459,7 +8030,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_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":145
+ /* "cdec/grammar.pxi":145
* def __set__(self, a):
* cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
* a_.resize(len(a)) # <<<<<<<<<<<<<<
@@ -7469,7 +8040,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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_a_->resize(__pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":148
+ /* "cdec/grammar.pxi":148
* cdef unsigned i
* cdef int s, t
* for i in range(len(a)): # <<<<<<<<<<<<<<
@@ -7480,14 +8051,14 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":149
+ /* "cdec/grammar.pxi":149
* cdef int s, t
* for i in range(len(a)):
* s, t = a[i] # <<<<<<<<<<<<<<
* a_[0][i] = grammar.AlignmentPoint(s, t)
*
*/
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_a, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
@@ -7518,8 +8089,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
__Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
@@ -7540,14 +8110,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L6_unpacking_done:;
}
- __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_s = __pyx_t_8;
__pyx_v_t = __pyx_t_9;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":150
+ /* "cdec/grammar.pxi":150
* for i in range(len(a)):
* s, t = a[i]
* a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<<
@@ -7557,6 +8127,15 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
((__pyx_v_a_[0])[__pyx_v_i]) = AlignmentPoint(__pyx_v_s, __pyx_v_t);
}
+ /* "cdec/grammar.pxi":143
+ * yield (a[0][i].s_, a[0][i].t_)
+ *
+ * def __set__(self, a): # <<<<<<<<<<<<<<
+ * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_
+ * a_.resize(len(a))
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -7571,6 +8150,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "cdec/grammar.pxi":153
+ *
+ * property scores:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector scores = SparseVector.__new__(SparseVector)
+ * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) {
@@ -7578,18 +8165,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":153
- *
- * property scores:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector scores = SparseVector.__new__(SparseVector)
- * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_scores = 0;
PyObject *__pyx_r = NULL;
@@ -7600,29 +8181,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":154
+ /* "cdec/grammar.pxi":154
* property scores:
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_scores = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":155
+ /* "cdec/grammar.pxi":155
* def __get__(self):
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<<
* return scores
*
*/
- __pyx_v_scores->vector = new FastSparseVector<double>(__pyx_v_self->rule->get()->scores_);
+ __pyx_v_scores->vector = new FastSparseVector<double> (__pyx_v_self->rule->get()->scores_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":156
+ /* "cdec/grammar.pxi":156
* cdef SparseVector scores = SparseVector.__new__(SparseVector)
* scores.vector = new FastSparseVector[double](self.rule.get().scores_)
* return scores # <<<<<<<<<<<<<<
@@ -7634,8 +8215,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
__pyx_r = ((PyObject *)__pyx_v_scores);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":153
+ *
+ * property scores:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector scores = SparseVector.__new__(SparseVector)
+ * scores.vector = new FastSparseVector[double](self.rule.get().scores_)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7647,6 +8235,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4
return __pyx_r;
}
+/* "cdec/grammar.pxi":158
+ * return scores
+ *
+ * def __set__(self, scores): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
+ * scores_.clear()
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores) {
@@ -7654,20 +8250,14 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_scores));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":158
- * return scores
- *
- * def __set__(self, scores): # <<<<<<<<<<<<<<
- * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
- * scores_.clear()
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_scores) {
- FastSparseVector<double> *__pyx_v_scores_;
+ FastSparseVector<double> *__pyx_v_scores_;
int __pyx_v_fid;
float __pyx_v_fval;
PyObject *__pyx_v_fname = NULL;
@@ -7676,9 +8266,9 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
- PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
@@ -7690,7 +8280,7 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":159
+ /* "cdec/grammar.pxi":159
*
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<<
@@ -7699,7 +8289,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_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":160
+ /* "cdec/grammar.pxi":160
* def __set__(self, scores):
* cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
* scores_.clear() # <<<<<<<<<<<<<<
@@ -7708,55 +8298,73 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
*/
__pyx_v_scores_->clear();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":163
+ /* "cdec/grammar.pxi":163
* cdef int fid
* cdef float fval
* for fname, fval in scores.items(): # <<<<<<<<<<<<<<
* fn = as_str(fname)
* fid = FDConvert(fn)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_scores, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ } else {
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
- PyObject* sequence = __pyx_t_2;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -7769,30 +8377,29 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
+ index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -7808,35 +8415,33 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
}
__pyx_t_9 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_9 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_3);
+ __pyx_t_3 = 0;
__pyx_v_fval = __pyx_t_9;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":164
+ /* "cdec/grammar.pxi":164
* cdef float fval
* for fname, fval in scores.items():
* fn = as_str(fname) # <<<<<<<<<<<<<<
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname)
*/
- __pyx_t_2 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_fname, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_XDECREF(((PyObject *)__pyx_v_fn));
- __pyx_v_fn = ((PyObject*)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_1 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_fname, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_fn, ((PyObject*)__pyx_t_1));
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":165
+ /* "cdec/grammar.pxi":165
* for fname, fval in scores.items():
* fn = as_str(fname)
* fid = FDConvert(fn) # <<<<<<<<<<<<<<
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval)
*/
- __pyx_t_10 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_fn); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fid = FD::Convert(__pyx_t_10);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":166
+ /* "cdec/grammar.pxi":166
* fn = as_str(fname)
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<<
@@ -7845,22 +8450,20 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
*/
__pyx_t_11 = ((__pyx_v_fid < 0) != 0);
if (__pyx_t_11) {
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_fname);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fname);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fname);
__Pyx_GIVEREF(__pyx_v_fname);
- __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L7;
}
- __pyx_L7:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":167
+ /* "cdec/grammar.pxi":167
* fid = FDConvert(fn)
* if fid < 0: raise KeyError(fname)
* scores_.set_value(fid, fval) # <<<<<<<<<<<<<<
@@ -7868,15 +8471,32 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
* property lhs:
*/
__pyx_v_scores_->set_value(__pyx_v_fid, __pyx_v_fval);
+
+ /* "cdec/grammar.pxi":163
+ * cdef int fid
+ * cdef float fval
+ * for fname, fval in scores.items(): # <<<<<<<<<<<<<<
+ * fn = as_str(fname)
+ * fid = FDConvert(fn)
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "cdec/grammar.pxi":158
+ * return scores
+ *
+ * def __set__(self, scores): # <<<<<<<<<<<<<<
+ * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_
+ * scores_.clear()
+ */
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -7888,6 +8508,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/grammar.pxi":170
+ *
+ * property lhs:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) {
@@ -7895,18 +8523,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":170
- *
- * property lhs:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return NT(TDConvert(-self.rule.get().lhs_).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -7917,7 +8539,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":171
+ /* "cdec/grammar.pxi":171
* property lhs:
* def __get__(self):
* return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<<
@@ -7926,21 +8548,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBytes_FromString(TD::Convert((-__pyx_v_self->rule->get()->lhs_)).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":170
+ *
+ * property lhs:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -7952,6 +8581,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cde
return __pyx_r;
}
+/* "cdec/grammar.pxi":173
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ * def __set__(self, lhs): # <<<<<<<<<<<<<<
+ * if not isinstance(lhs, NT):
+ * lhs = NT(lhs)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs); /*proto*/
static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs) {
@@ -7959,18 +8596,12 @@ static int __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_lhs));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":173
- * return NT(TDConvert(-self.rule.get().lhs_).c_str())
- *
- * def __set__(self, lhs): # <<<<<<<<<<<<<<
- * if not isinstance(lhs, NT):
- * lhs = NT(lhs)
- */
-
static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs) {
int __pyx_r;
__Pyx_RefNannyDeclarations
@@ -7985,7 +8616,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":174
+ /* "cdec/grammar.pxi":174
*
* def __set__(self, lhs):
* if not isinstance(lhs, NT): # <<<<<<<<<<<<<<
@@ -7996,7 +8627,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":175
+ /* "cdec/grammar.pxi":175
* def __set__(self, lhs):
* if not isinstance(lhs, NT):
* lhs = NT(lhs) # <<<<<<<<<<<<<<
@@ -8008,26 +8639,34 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
__Pyx_INCREF(__pyx_v_lhs);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lhs);
__Pyx_GIVEREF(__pyx_v_lhs);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_lhs);
- __pyx_v_lhs = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_lhs, __pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":176
+ /* "cdec/grammar.pxi":176
* if not isinstance(lhs, NT):
* lhs = NT(lhs)
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
- __pyx_t_5 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_lhs)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_AsString(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_lhs)->cat); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->rule->get()->lhs_ = (-TD::Convert(__pyx_t_5));
+ /* "cdec/grammar.pxi":173
+ * return NT(TDConvert(-self.rule.get().lhs_).c_str())
+ *
+ * def __set__(self, lhs): # <<<<<<<<<<<<<<
+ * if not isinstance(lhs, NT):
+ * lhs = NT(lhs)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -8041,6 +8680,14 @@ static int __pyx_pf_4cdec_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_4cdec_5_c
return __pyx_r;
}
+/* "cdec/grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
@@ -8048,12 +8695,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_4__str__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+/* "cdec/grammar.pxi":179
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
@@ -8079,25 +8728,23 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_s
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator23, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_str___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -8120,37 +8767,40 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s__scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_scores); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -8158,13 +8808,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_feat, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_feat = __pyx_t_1;
__pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_r = ((PyObject *)__pyx_t_1);
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -8184,6 +8833,8 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8198,7 +8849,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator22(__pyx_Genera
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":178
+/* "cdec/grammar.pxi":178
* self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -8216,6 +8867,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -8230,30 +8883,22 @@ 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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":179
+ /* "cdec/grammar.pxi":179
*
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<<
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_7), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_v_scores = __pyx_t_2;
+ __pyx_v_scores = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":180
+ /* "cdec/grammar.pxi":180
* def __str__(self):
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
@@ -8261,71 +8906,122 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
*
*/
__Pyx_XDECREF(__pyx_r);
- __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":181
+ /* "cdec/grammar.pxi":181
* scores = ' '.join('%s=%s' % feat for feat in self.scores)
* return '%s ||| %s ||| %s ||| %s' % (self.lhs,
* _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<<
*
* cdef class MRule(TRule):
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s___phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_phrase); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__e); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "cdec/grammar.pxi":180
+ * def __str__(self):
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<<
+ * _phrase(self.f), _phrase(self.e), scores)
+ *
+ */
+ __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_scores);
- PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_scores);
__Pyx_GIVEREF(__pyx_v_scores);
__pyx_t_2 = 0;
__pyx_t_1 = 0;
__pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_s_s_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/grammar.pxi":178
+ * self.rule.get().lhs_ = -TDConvert((<NT> lhs).cat)
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * scores = ' '.join('%s=%s' % feat for feat in self.scores)
+ * return '%s ||| %s ||| %s ||| %s' % (self.lhs,
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -8336,6 +9032,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "cdec/grammar.pxi":184
+ *
+ * cdef class MRule(TRule):
+ * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
+ * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
+ * lhs: left hand side non-terminal
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_5MRule___init__[] = "MRule(lhs, rhs, scores, a=None) -> Monolingual rule.\n lhs: left hand side non-terminal\n rhs: right hand side phrase (list of words/NT)\n scores: dictionary of feature scores";
@@ -8353,7 +9057,7 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__rhs,&__pyx_n_s__scores,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lhs,&__pyx_n_s_rhs,&__pyx_n_s_scores,0};
PyObject* values[3] = {0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -8368,15 +9072,15 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lhs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lhs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rhs)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rhs)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
- if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores)) != 0)) kw_args--;
+ if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
@@ -8404,18 +9108,12 @@ static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObje
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_5MRule___init__(((struct __pyx_obj_4cdec_5_cdec_MRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_rhs, __pyx_v_scores);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":184
- *
- * cdef class MRule(TRule):
- * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
- * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
- * lhs: left hand side non-terminal
- */
-
static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores) {
unsigned int __pyx_v_i;
PyObject *__pyx_v_e = NULL;
@@ -8430,12 +9128,13 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
int __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":189
+ /* "cdec/grammar.pxi":189
* rhs: right hand side phrase (list of words/NT)
* scores: dictionary of feature scores"""
* cdef unsigned i = 1 # <<<<<<<<<<<<<<
@@ -8444,7 +9143,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
*/
__pyx_v_i = 1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":190
+ /* "cdec/grammar.pxi":190
* scores: dictionary of feature scores"""
* cdef unsigned i = 1
* e = [] # <<<<<<<<<<<<<<
@@ -8456,52 +9155,54 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":191
+ /* "cdec/grammar.pxi":191
* cdef unsigned i = 1
* e = []
* for s in rhs: # <<<<<<<<<<<<<<
* if isinstance(s, NT):
* e.append(NTRef(i))
*/
- if (PyList_CheckExact(__pyx_v_rhs) || PyTuple_CheckExact(__pyx_v_rhs)) {
+ if (likely(PyList_CheckExact(__pyx_v_rhs)) || PyTuple_CheckExact(__pyx_v_rhs)) {
__pyx_t_1 = __pyx_v_rhs; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF(__pyx_v_s);
- __pyx_v_s = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":192
+ /* "cdec/grammar.pxi":192
* e = []
* for s in rhs:
* if isinstance(s, NT): # <<<<<<<<<<<<<<
@@ -8512,27 +9213,27 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":193
+ /* "cdec/grammar.pxi":193
* for s in rhs:
* if isinstance(s, NT):
* e.append(NTRef(i)) # <<<<<<<<<<<<<<
* i += 1
* else:
*/
- __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_NTRef)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__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 = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":194
+ /* "cdec/grammar.pxi":194
* if isinstance(s, NT):
* e.append(NTRef(i))
* i += 1 # <<<<<<<<<<<<<<
@@ -8544,7 +9245,7 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":196
+ /* "cdec/grammar.pxi":196
* i += 1
* else:
* e.append(s) # <<<<<<<<<<<<<<
@@ -8554,59 +9255,92 @@ 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_v_s); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L5:;
+
+ /* "cdec/grammar.pxi":191
+ * cdef unsigned i = 1
+ * e = []
+ * for s in rhs: # <<<<<<<<<<<<<<
+ * if isinstance(s, NT):
+ * e.append(NTRef(i))
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":197
+ /* "cdec/grammar.pxi":197
* else:
* e.append(s)
* super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<<
*
* cdef class Grammar:
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
__Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_MRule)));
__Pyx_INCREF(((PyObject *)__pyx_v_self));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_4 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(5+__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
__Pyx_INCREF(__pyx_v_lhs);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_lhs);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_v_lhs);
__Pyx_GIVEREF(__pyx_v_lhs);
__Pyx_INCREF(__pyx_v_rhs);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_rhs);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_v_rhs);
__Pyx_GIVEREF(__pyx_v_rhs);
- __Pyx_INCREF(((PyObject *)__pyx_v_e));
- PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_e));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e));
+ __Pyx_INCREF(__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_2, __pyx_v_e);
+ __Pyx_GIVEREF(__pyx_v_e);
__Pyx_INCREF(__pyx_v_scores);
- PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_scores);
+ PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_2, __pyx_v_scores);
__Pyx_GIVEREF(__pyx_v_scores);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_4, 4, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_2, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ /* "cdec/grammar.pxi":184
+ *
+ * cdef class MRule(TRule):
+ * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<<
+ * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule.
+ * lhs: left hand side non-terminal
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec._cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -8616,28 +9350,30 @@ static int __pyx_pf_4cdec_5_cdec_5MRule___init__(struct __pyx_obj_4cdec_5_cdec_M
return __pyx_r;
}
+/* "cdec/grammar.pxi":202
+ * cdef shared_ptr[grammar.Grammar]* grammar
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.grammar
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":202
- * cdef shared_ptr[grammar.Grammar]* grammar
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.grammar
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":203
+ /* "cdec/grammar.pxi":203
*
* def __dealloc__(self):
* del self.grammar # <<<<<<<<<<<<<<
@@ -8646,10 +9382,27 @@ static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __py
*/
delete __pyx_v_self->grammar;
+ /* "cdec/grammar.pxi":202
+ * cdef shared_ptr[grammar.Grammar]* grammar
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.grammar
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/grammar.pxi":205
+ * del self.grammar
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) {
@@ -8657,18 +9410,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":205
- * del self.grammar
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
- * cdef grammar.const_RuleBin* rbin = root.GetRules()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -8687,18 +9434,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(struct __pyx_obj_4cdec
__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_7Grammar_4generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Grammar___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Grammar.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -8727,7 +9472,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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":206
+ /* "cdec/grammar.pxi":206
*
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<<
@@ -8736,7 +9481,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();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":207
+ /* "cdec/grammar.pxi":207
* def __iter__(self):
* cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
* cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<<
@@ -8745,7 +9490,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();
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":210
+ /* "cdec/grammar.pxi":210
* cdef TRule trule
* cdef unsigned i
* for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<<
@@ -8756,32 +9501,31 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":211
+ /* "cdec/grammar.pxi":211
* cdef unsigned i
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule
*/
- __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_trule));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_trule, ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3));
__Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":212
+ /* "cdec/grammar.pxi":212
* for i in range(rbin.GetNumRules()):
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<<
* yield trule
*
*/
- __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));
+ __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));
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":213
+ /* "cdec/grammar.pxi":213
* trule = TRule.__new__(TRule)
* trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i))
* yield trule # <<<<<<<<<<<<<<
@@ -8802,6 +9546,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/grammar.pxi":205
+ * del self.grammar
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot()
+ * cdef grammar.const_RuleBin* rbin = root.GetRules()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8815,6 +9569,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObjec
return NULL;
}
+/* "cdec/grammar.pxi":216
+ *
+ * property name:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) {
@@ -8822,18 +9584,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":216
- *
- * property name:
- * def __get__(self): # <<<<<<<<<<<<<<
- * str(self.grammar.get().GetGrammarName().c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -8844,7 +9600,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":217
+ /* "cdec/grammar.pxi":217
* property name:
* def __get__(self):
* str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<<
@@ -8852,17 +9608,26 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
* def __set__(self, name):
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->grammar->get()->GetGrammarName().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "cdec/grammar.pxi":216
+ *
+ * property name:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -8876,6 +9641,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(struct __pyx_obj_4
return __pyx_r;
}
+/* "cdec/grammar.pxi":219
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ * def __set__(self, name): # <<<<<<<<<<<<<<
+ * name = as_str(name)
+ * self.grammar.get().SetGrammarName(name)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
@@ -8883,18 +9656,12 @@ static int __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self), ((PyObject *)__pyx_v_name));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":219
- * str(self.grammar.get().GetGrammarName().c_str())
- *
- * def __set__(self, name): # <<<<<<<<<<<<<<
- * name = as_str(name)
- * self.grammar.get().SetGrammarName(name)
- */
-
static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_name) {
int __pyx_r;
__Pyx_RefNannyDeclarations
@@ -8906,20 +9673,19 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
__Pyx_RefNannySetupContext("__set__", 0);
__Pyx_INCREF(__pyx_v_name);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":220
+ /* "cdec/grammar.pxi":220
*
* def __set__(self, name):
* name = as_str(name) # <<<<<<<<<<<<<<
* self.grammar.get().SetGrammarName(name)
*
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_name, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_v_name);
- __pyx_v_name = __pyx_t_1;
+ __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":221
+ /* "cdec/grammar.pxi":221
* def __set__(self, name):
* name = as_str(name)
* self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<<
@@ -8929,6 +9695,15 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
__pyx_t_2 = __pyx_convert_string_from_py_(__pyx_v_name); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->grammar->get()->SetGrammarName(__pyx_t_2);
+ /* "cdec/grammar.pxi":219
+ * str(self.grammar.get().GetGrammarName().c_str())
+ *
+ * def __set__(self, name): # <<<<<<<<<<<<<<
+ * name = as_str(name)
+ * self.grammar.get().SetGrammarName(name)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -8941,6 +9716,14 @@ static int __pyx_pf_4cdec_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/grammar.pxi":224
+ *
+ * cdef class TextGrammar(Grammar):
+ * def __init__(self, rules): # <<<<<<<<<<<<<<
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_11TextGrammar___init__[] = "TextGrammar(rules) -> SCFG Grammar containing the rules.";
@@ -8956,7 +9739,7 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rules,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rules,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -8969,7 +9752,7 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rules)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rules)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -8991,18 +9774,12 @@ static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self,
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_v_self), __pyx_v_rules);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":224
- *
- * cdef class TextGrammar(Grammar):
- * def __init__(self, rules): # <<<<<<<<<<<<<<
- * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
- * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
- */
-
static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5_cdec_TextGrammar *__pyx_v_self, PyObject *__pyx_v_rules) {
TextGrammar *__pyx_v__g;
PyObject *__pyx_v_trule = NULL;
@@ -9019,16 +9796,16 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":226
+ /* "cdec/grammar.pxi":226
* def __init__(self, rules):
* """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()
* for trule in rules:
*/
- __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar>(new TextGrammar());
+ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr<Grammar> (new TextGrammar());
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":227
+ /* "cdec/grammar.pxi":227
* """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() # <<<<<<<<<<<<<<
@@ -9037,52 +9814,54 @@ 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());
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":228
+ /* "cdec/grammar.pxi":228
* self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules: # <<<<<<<<<<<<<<
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
*/
- if (PyList_CheckExact(__pyx_v_rules) || PyTuple_CheckExact(__pyx_v_rules)) {
+ if (likely(PyList_CheckExact(__pyx_v_rules)) || PyTuple_CheckExact(__pyx_v_rules)) {
__pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF(__pyx_v_trule);
- __pyx_v_trule = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_v_trule, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":229
+ /* "cdec/grammar.pxi":229
* cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
* for trule in rules:
* if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<<
@@ -9093,7 +9872,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":230
+ /* "cdec/grammar.pxi":230
* for trule in rules:
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule) # <<<<<<<<<<<<<<
@@ -9103,13 +9882,12 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
if (!(likely(((__pyx_v_trule) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_trule, __pyx_ptype_4cdec_2sa_3_sa_Rule))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = ((PyObject *)__pyx_f_4cdec_5_cdec_convert_rule(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_trule))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_v_trule);
- __pyx_v_trule = __pyx_t_4;
+ __Pyx_DECREF_SET(__pyx_v_trule, __pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L5;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":231
+ /* "cdec/grammar.pxi":231
* if isinstance(trule, _sa.Rule):
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule): # <<<<<<<<<<<<<<
@@ -9120,30 +9898,46 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":232
+ /* "cdec/grammar.pxi":232
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":233
+ /* "cdec/grammar.pxi":233
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects')
* _g.AddRule((<TRule> trule).rule[0]) # <<<<<<<<<<<<<<
*/
__pyx_v__g->AddRule((((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_trule)->rule[0]));
+
+ /* "cdec/grammar.pxi":228
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ * cdef grammar.TextGrammar* _g = <grammar.TextGrammar*> self.grammar.get()
+ * for trule in rules: # <<<<<<<<<<<<<<
+ * if isinstance(trule, _sa.Rule):
+ * trule = convert_rule(trule)
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "cdec/grammar.pxi":224
+ *
+ * cdef class TextGrammar(Grammar):
+ * def __init__(self, rules): # <<<<<<<<<<<<<<
+ * """TextGrammar(rules) -> SCFG Grammar containing the rules."""
+ * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar())
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -9157,29 +9951,31 @@ static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":8
+ * cdef MT19937* rng
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.hg
+ * if self.rng != NULL:
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":8
- * cdef MT19937* rng
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.hg
- * if self.rng != NULL:
- */
-
static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":9
+ /* "cdec/hypergraph.pxi":9
*
* def __dealloc__(self):
* del self.hg # <<<<<<<<<<<<<<
@@ -9188,7 +9984,7 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde
*/
delete __pyx_v_self->hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":10
+ /* "cdec/hypergraph.pxi":10
* def __dealloc__(self):
* del self.hg
* if self.rng != NULL: # <<<<<<<<<<<<<<
@@ -9198,7 +9994,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":11
+ /* "cdec/hypergraph.pxi":11
* del self.hg
* if self.rng != NULL:
* del self.rng # <<<<<<<<<<<<<<
@@ -9210,10 +10006,19 @@ static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cde
}
__pyx_L3:;
+ /* "cdec/hypergraph.pxi":8
+ * cdef MT19937* rng
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.hg
+ * if self.rng != NULL:
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":13
+/* "cdec/hypergraph.pxi":13
* del self.rng
*
* cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
@@ -9231,7 +10036,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_rng", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":14
+ /* "cdec/hypergraph.pxi":14
*
* cdef MT19937* _rng(self):
* if self.rng == NULL: # <<<<<<<<<<<<<<
@@ -9241,7 +10046,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":15
+ /* "cdec/hypergraph.pxi":15
* cdef MT19937* _rng(self):
* if self.rng == NULL:
* self.rng = new MT19937() # <<<<<<<<<<<<<<
@@ -9259,7 +10064,7 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":16
+ /* "cdec/hypergraph.pxi":16
* if self.rng == NULL:
* self.rng = new MT19937()
* return self.rng # <<<<<<<<<<<<<<
@@ -9269,16 +10074,31 @@ static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_
__pyx_r = __pyx_v_self->rng;
goto __pyx_L0;
- __pyx_r = 0;
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":13
+ * del self.rng
+ *
+ * cdef MT19937* _rng(self): # <<<<<<<<<<<<<<
+ * if self.rng == NULL:
+ * self.rng = new MT19937()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
- __Pyx_WriteUnraisable("cdec._cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_WriteUnraisable("cdec._cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":18
+ * return self.rng
+ *
+ * def viterbi(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
+ * cdef vector[WordID] trans
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi[] = "hg.viterbi() -> String for the best hypothesis in the hypergraph.";
@@ -9287,20 +10107,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":18
- * return self.rng
- *
- * def viterbi(self): # <<<<<<<<<<<<<<
- * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
- * cdef vector[WordID] trans
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- std::vector<WordID> __pyx_v_trans;
+ std::vector<WordID> __pyx_v_trans;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -9310,7 +10124,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":21
+ /* "cdec/hypergraph.pxi":21
* """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<<
@@ -9319,7 +10133,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
*/
ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":22
+ /* "cdec/hypergraph.pxi":22
* cdef vector[WordID] trans
* hypergraph.ViterbiESentence(self.hg[0], &trans)
* return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -9328,24 +10142,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_v_trans).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":18
+ * return self.rng
+ *
+ * def viterbi(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi() -> String for the best hypothesis in the hypergraph."""
+ * cdef vector[WordID] trans
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9357,6 +10178,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4c
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":24
+ * return unicode(GetString(trans).c_str(), 'utf8')
+ *
+ * def viterbi_trees(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_trees() -> (f_tree, e_tree)
+ * f_tree: Source tree for the best hypothesis in the hypergraph.
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees[] = "hg.viterbi_trees() -> (f_tree, e_tree)\n f_tree: Source tree for the best hypothesis in the hypergraph.\n e_tree: Target tree for the best hypothesis in the hypergraph.\n ";
@@ -9365,18 +10194,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":24
- * return unicode(GetString(trans).c_str(), 'utf8')
- *
- * def viterbi_trees(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_trees() -> (f_tree, e_tree)
- * f_tree: Source tree for the best hypothesis in the hypergraph.
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_v_f_tree = NULL;
PyObject *__pyx_v_e_tree = NULL;
@@ -9389,7 +10212,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_trees", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":29
+ /* "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') # <<<<<<<<<<<<<<
@@ -9397,22 +10220,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
* return (f_tree, e_tree)
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(ViterbiFTree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_f_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":30
+ /* "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') # <<<<<<<<<<<<<<
@@ -9420,22 +10243,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
*
*/
__pyx_t_1 = __Pyx_PyBytes_FromString(ViterbiETree((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_e_tree = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":31
+ /* "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) # <<<<<<<<<<<<<<
@@ -9445,18 +10268,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_v_e_tree);
+ __pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":24
+ * return unicode(GetString(trans).c_str(), 'utf8')
+ *
+ * def viterbi_trees(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_trees() -> (f_tree, e_tree)
+ * f_tree: Source tree for the best hypothesis in the hypergraph.
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9470,6 +10300,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":33
+ * return (f_tree, e_tree)
+ *
+ * def viterbi_features(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_features() -> SparseVector with the features corresponding
+ * to the best derivation in the hypergraph."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features[] = "hg.viterbi_features() -> SparseVector with the features corresponding\n to the best derivation in the hypergraph.";
@@ -9478,18 +10316,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":33
- * return (f_tree, e_tree)
- *
- * def viterbi_features(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_features() -> SparseVector with the features corresponding
- * to the best derivation in the hypergraph."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap = 0;
PyObject *__pyx_r = NULL;
@@ -9500,29 +10332,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_features", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":36
+ /* "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) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":37
+ /* "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])) # <<<<<<<<<<<<<<
* return fmap
*
*/
- __pyx_v_fmap->vector = new FastSparseVector<weight_t>(ViterbiFeatures((__pyx_v_self->hg[0])));
+ __pyx_v_fmap->vector = new FastSparseVector<weight_t> (ViterbiFeatures((__pyx_v_self->hg[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":38
+ /* "cdec/hypergraph.pxi":38
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0]))
* return fmap # <<<<<<<<<<<<<<
@@ -9534,8 +10366,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
__pyx_r = ((PyObject *)__pyx_v_fmap);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":33
+ * return (f_tree, e_tree)
+ *
+ * def viterbi_features(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_features() -> SparseVector with the features corresponding
+ * to the best derivation in the hypergraph."""
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -9547,6 +10386,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __p
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":40
+ * return fmap
+ *
+ * def viterbi_forest(self): # <<<<<<<<<<<<<<
+ * cdef Hypergraph hg = Hypergraph()
+ * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
@@ -9554,18 +10401,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_forest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":40
- * return fmap
- *
- * def viterbi_forest(self): # <<<<<<<<<<<<<<
- * cdef Hypergraph hg = Hypergraph()
- * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hg = 0;
PyObject *__pyx_r = NULL;
@@ -9576,19 +10417,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_forest", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":41
+ /* "cdec/hypergraph.pxi":41
*
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<<
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
* return hg
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":42
+ /* "cdec/hypergraph.pxi":42
* def viterbi_forest(self):
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<<
@@ -9597,7 +10438,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]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":43
+ /* "cdec/hypergraph.pxi":43
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
* return hg # <<<<<<<<<<<<<<
@@ -9609,8 +10450,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
__pyx_r = ((PyObject *)__pyx_v_hg);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":40
+ * return fmap
+ *
+ * def viterbi_forest(self): # <<<<<<<<<<<<<<
+ * cdef Hypergraph hg = Hypergraph()
+ * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0])
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_forest", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -9622,6 +10470,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":45
+ * return hg
+ *
+ * def viterbi_joshua(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua[] = "hg.viterbi_joshua() -> Joshua representation of the best derivation.";
@@ -9630,18 +10486,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("viterbi_joshua (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":45
- * return hg
- *
- * def viterbi_joshua(self): # <<<<<<<<<<<<<<
- * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -9652,7 +10502,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("viterbi_joshua", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":47
+ /* "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') # <<<<<<<<<<<<<<
@@ -9661,24 +10511,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBytes_FromString(JoshuaVisualizationString((__pyx_v_self->hg[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":45
+ * return hg
+ *
+ * def viterbi_joshua(self): # <<<<<<<<<<<<<<
+ * """hg.viterbi_joshua() -> Joshua representation of the best derivation."""
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -9691,6 +10548,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __py
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ *
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest[] = "hg.kbest(size) -> List of k-best hypotheses in the hypergraph.";
@@ -9699,18 +10564,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":49
- * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
- *
- * def kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -9732,18 +10591,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_4cd
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest, __pyx_n_s_Hypergraph_kbest); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -9759,6 +10616,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -9774,17 +10640,17 @@ 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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":51
+ /* "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, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]].Derivation* derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":54
+ /* "cdec/hypergraph.pxi":54
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -9793,18 +10659,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":55
+ /* "cdec/hypergraph.pxi":55
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":56
+ /* "cdec/hypergraph.pxi":56
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -9813,7 +10679,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":57
+ /* "cdec/hypergraph.pxi":57
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -9823,30 +10689,28 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
__pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":58
+ /* "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') # <<<<<<<<<<<<<<
* finally:
* del derivations
*/
- __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
@@ -9859,12 +10723,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":60
+ /* "cdec/hypergraph.pxi":60
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -9872,32 +10736,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
* def kbest_trees(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":49
+ * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8')
+ *
+ * def kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -9913,6 +10798,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":62
+ * del derivations
+ *
+ * def kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees[] = "hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter.";
@@ -9921,18 +10814,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":62
- * del derivations
- *
- * def kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -9954,18 +10841,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_o
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest_trees, __pyx_n_s_Hypergraph_kbest_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -9980,9 +10865,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ char const *__pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -9990,7 +10883,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L12_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -9998,27 +10891,27 @@ 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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":64
+ /* "cdec/hypergraph.pxi":64
* def kbest_trees(self, size):
* """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":66
+ /* "cdec/hypergraph.pxi":66
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]].Derivation* e_derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::NoFilter<std::vector<int> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<std::vector<int> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":69
+ /* "cdec/hypergraph.pxi":69
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.NoFilter[vector[int]]].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10027,18 +10920,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":70
+ /* "cdec/hypergraph.pxi":70
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":71
+ /* "cdec/hypergraph.pxi":71
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10047,7 +10940,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":72
+ /* "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) # <<<<<<<<<<<<<<
@@ -10056,95 +10949,95 @@ 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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":73
+ /* "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 # <<<<<<<<<<<<<<
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
*/
- __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
- if (!__pyx_t_3) {
- __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
+ if (!__pyx_t_4) {
+ goto __pyx_L11_next_or;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L10_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L11_next_or:;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":74
+ /* "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') # <<<<<<<<<<<<<<
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree)
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":75
+ /* "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') # <<<<<<<<<<<<<<
* yield (f_tree, e_tree)
* finally:
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":76
+ /* "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) # <<<<<<<<<<<<<<
* finally:
* del f_derivations
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -10152,15 +11045,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
+ __pyx_L12_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 = 76; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":78
+ /* "cdec/hypergraph.pxi":78
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -10168,46 +11061,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
*
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
+
+ /* "cdec/hypergraph.pxi":79
+ * finally:
+ * del f_derivations
+ * del e_derivations # <<<<<<<<<<<<<<
+ *
+ * def kbest_features(self, size):
+ */
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_f_derivations;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
+ {
+
+ /* "cdec/hypergraph.pxi":78
+ * yield (f_tree, e_tree)
+ * finally:
+ * del f_derivations # <<<<<<<<<<<<<<
+ * del e_derivations
+ *
+ */
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":79
+ /* "cdec/hypergraph.pxi":79
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
*
* def kbest_features(self, size):
*/
- delete __pyx_cur_scope->__pyx_v_e_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ }
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":62
+ * del derivations
+ *
+ * def kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of k-best trees in the hypergrapt.NoFilter."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.NoFilter[vector[int]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -10218,6 +11149,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":81
+ * del e_derivations
+ *
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features[] = "hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.";
@@ -10226,18 +11165,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("kbest_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":81
- * del e_derivations
- *
- * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10259,18 +11192,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(struct __py
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_kbest_features, __pyx_n_s_Hypergraph_kbest_features); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10285,6 +11216,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ char const *__pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10300,17 +11240,17 @@ 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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":83
+ /* "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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]].Derivation* derivation
* cdef SparseVector fmap
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__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,KBest::NoFilter<FastSparseVector<double> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":87
+ /* "cdec/hypergraph.pxi":87
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10319,18 +11259,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":88
+ /* "cdec/hypergraph.pxi":88
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":89
+ /* "cdec/hypergraph.pxi":89
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10339,7 +11279,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":90
+ /* "cdec/hypergraph.pxi":90
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -10349,36 +11289,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
__pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":91
+ /* "cdec/hypergraph.pxi":91
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap
*/
- __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fmap, ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4));
__Pyx_GIVEREF(__pyx_t_4);
- __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":92
+ /* "cdec/hypergraph.pxi":92
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
* yield fmap
* finally:
*/
- __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
+ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":93
+ /* "cdec/hypergraph.pxi":93
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -10397,12 +11334,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":95
+ /* "cdec/hypergraph.pxi":95
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -10410,31 +11347,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
* def unique_kbest(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
+ }
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":81
+ * del e_derivations
+ *
+ * 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, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -10449,6 +11407,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":97
+ * del derivations
+ *
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest[] = "hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph.";
@@ -10457,18 +11423,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":97
- * del derivations
- *
- * def unique_kbest(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10490,18 +11450,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21unique_kbest(struct __pyx_
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest, __pyx_n_s_Hypergraph_unique_kbest); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10517,6 +11475,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10532,17 +11499,17 @@ 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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":99
+ /* "cdec/hypergraph.pxi":99
* def unique_kbest(self, size):
* """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique].Derivation* derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID>,ESentenceTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<std::vector<WordID> ,ESentenceTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":102
+ /* "cdec/hypergraph.pxi":102
* cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique].Derivation* derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10551,18 +11518,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":103
+ /* "cdec/hypergraph.pxi":103
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":104
+ /* "cdec/hypergraph.pxi":104
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10571,7 +11538,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":105
+ /* "cdec/hypergraph.pxi":105
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -10581,30 +11548,28 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
__pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":106
+ /* "cdec/hypergraph.pxi":106
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del derivations
*/
- __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_derivation->yield).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
@@ -10617,12 +11582,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":108
+ /* "cdec/hypergraph.pxi":108
* yield unicode(GetString(derivation._yield).c_str(), 'utf8')
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -10630,32 +11595,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
* def unique_kbest_trees(self, size):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":97
+ * del derivations
+ *
+ * def unique_kbest(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest(size) -> List of unique k-best hypotheses in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -10671,6 +11657,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":110
+ * del derivations
+ *
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees[] = "hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph.";
@@ -10679,18 +11673,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest_trees (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":110
- * del derivations
- *
- * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
- * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -10712,18 +11700,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees(struct
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest_trees, __pyx_n_s_Hypergraph_unique_kbest_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -10738,9 +11724,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ char const *__pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -10748,7 +11742,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L10_resume_from_yield;
+ case 1: goto __pyx_L12_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -10756,27 +11750,27 @@ 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 = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":112
+ /* "cdec/hypergraph.pxi":112
* def unique_kbest_trees(self, size):
* """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique](self.hg[0], size)
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID>,FTreeTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_f_derivations = new KBest::KBestDerivations<std::vector<WordID> ,FTreeTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":114
+ /* "cdec/hypergraph.pxi":114
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
* cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique].Derivation* f_derivation
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique].Derivation* e_derivation
* cdef unsigned k
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID>,ETreeTraversal,KBest::FilterUnique>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_e_derivations = new KBest::KBestDerivations<std::vector<WordID> ,ETreeTraversal,KBest::FilterUnique> ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":117
+ /* "cdec/hypergraph.pxi":117
* cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal, kbest.FilterUnique].Derivation* e_derivation
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -10785,18 +11779,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":118
+ /* "cdec/hypergraph.pxi":118
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":119
+ /* "cdec/hypergraph.pxi":119
* try:
* for k in range(size):
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -10805,7 +11799,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":120
+ /* "cdec/hypergraph.pxi":120
* 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) # <<<<<<<<<<<<<<
@@ -10814,95 +11808,95 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":121
+ /* "cdec/hypergraph.pxi":121
* f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break # <<<<<<<<<<<<<<
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
*/
- __pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
- if (!__pyx_t_3) {
- __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_f_derivation != 0)) != 0);
+ if (!__pyx_t_4) {
+ goto __pyx_L11_next_or;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L10_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L11_next_or:;
+ __pyx_t_4 = ((!(__pyx_cur_scope->__pyx_v_e_derivation != 0)) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":122
+ /* "cdec/hypergraph.pxi":122
* e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree)
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_f_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":123
+ /* "cdec/hypergraph.pxi":123
* if not f_derivation or not e_derivation: break
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<<
* yield (f_tree, e_tree)
* finally:
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_5 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_cur_scope->__pyx_v_e_derivation->yield).c_str()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6);
- __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e_tree, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":124
+ /* "cdec/hypergraph.pxi":124
* f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8')
* e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8')
* yield (f_tree, e_tree) # <<<<<<<<<<<<<<
* finally:
* del f_derivations
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_tree));
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_tree));
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_tree);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_tree);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_e_tree);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_tree);
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
@@ -10910,15 +11904,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L10_resume_from_yield:;
+ __pyx_L12_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 = 124; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":126
+ /* "cdec/hypergraph.pxi":126
* yield (f_tree, e_tree)
* finally:
* del f_derivations # <<<<<<<<<<<<<<
@@ -10926,46 +11920,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
*
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
+
+ /* "cdec/hypergraph.pxi":127
+ * finally:
+ * del f_derivations
+ * del e_derivations # <<<<<<<<<<<<<<
+ *
+ * def unique_kbest_features(self, size):
+ */
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_f_derivations;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
+ {
+
+ /* "cdec/hypergraph.pxi":126
+ * yield (f_tree, e_tree)
+ * finally:
+ * del f_derivations # <<<<<<<<<<<<<<
+ * del e_derivations
+ *
+ */
+ delete __pyx_cur_scope->__pyx_v_f_derivations;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":127
+ /* "cdec/hypergraph.pxi":127
* finally:
* del f_derivations
* del e_derivations # <<<<<<<<<<<<<<
*
* def unique_kbest_features(self, size):
*/
- delete __pyx_cur_scope->__pyx_v_e_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ delete __pyx_cur_scope->__pyx_v_e_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
}
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":110
+ * del derivations
+ *
+ * def unique_kbest_trees(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best trees in the hypergraph."""
+ * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal, kbest.FilterUnique](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("unique_kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -10976,6 +12008,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":129
+ * del e_derivations
+ *
+ * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
+ * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features[] = "hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph.";
@@ -10984,18 +12024,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("unique_kbest_features (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":129
- * del e_derivations
- *
- * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
- * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
- * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -11017,18 +12051,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27unique_kbest_features(stru
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_size);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_unique_kbest_features, __pyx_n_s_Hypergraph_unique_kbest_features); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.unique_kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -11043,6 +12075,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
long __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ char const *__pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11058,17 +12099,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":131
+ /* "cdec/hypergraph.pxi":131
* def unique_kbest_features(self, size):
* """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size) # <<<<<<<<<<<<<<
* cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]].Derivation* derivation
* cdef SparseVector fmap
*/
- __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t>,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > >((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
+ __pyx_t_1 = __Pyx_PyInt_As_unsigned_int(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_cur_scope->__pyx_v_derivations = new KBest::KBestDerivations<FastSparseVector<weight_t> ,FeatureVectorTraversal,KBest::NoFilter<FastSparseVector<double> > > ((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":135
+ /* "cdec/hypergraph.pxi":135
* cdef SparseVector fmap
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11077,18 +12118,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":136
+ /* "cdec/hypergraph.pxi":136
* cdef unsigned k
* try:
* for k in range(size): # <<<<<<<<<<<<<<
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
*/
- __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_size); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":137
+ /* "cdec/hypergraph.pxi":137
* try:
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<<
@@ -11097,7 +12138,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":138
+ /* "cdec/hypergraph.pxi":138
* for k in range(size):
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break # <<<<<<<<<<<<<<
@@ -11107,36 +12148,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__pyx_t_3 = ((!(__pyx_cur_scope->__pyx_v_derivation != 0)) != 0);
if (__pyx_t_3) {
goto __pyx_L8_break;
- goto __pyx_L9;
}
- __pyx_L9:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":139
+ /* "cdec/hypergraph.pxi":139
* derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k)
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap
*/
- __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
- __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fmap, ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4));
__Pyx_GIVEREF(__pyx_t_4);
- __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":140
+ /* "cdec/hypergraph.pxi":140
* if not derivation: break
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<<
* yield fmap
* finally:
*/
- __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_cur_scope->__pyx_v_derivation->yield);
+ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_cur_scope->__pyx_v_derivation->yield);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":141
+ /* "cdec/hypergraph.pxi":141
* fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](derivation._yield)
* yield fmap # <<<<<<<<<<<<<<
@@ -11155,12 +12193,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
__pyx_L10_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
__pyx_L8_break:;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":143
+ /* "cdec/hypergraph.pxi":143
* yield fmap
* finally:
* del derivations # <<<<<<<<<<<<<<
@@ -11168,31 +12206,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
* def sample(self, unsigned n):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_derivations;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_derivations;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_derivations;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
}
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+ __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
+ __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":129
+ * del e_derivations
+ *
+ * def unique_kbest_features(self, size): # <<<<<<<<<<<<<<
+ * """hg.kbest_trees(size) -> List of unique k-best feature vectors in the hypergraph."""
+ * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal, kbest.NoFilter[FastSparseVector[double]]](self.hg[0], size)
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11207,6 +12266,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_29generator9(__pyx_Generator
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_4cdec_5_cdec_10Hypergraph_30sample[] = "hg.sample(n) -> Sample of n hypotheses from the hypergraph.";
@@ -11219,7 +12286,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -11228,18 +12295,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample(PyObject *__pyx_v_s
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":145
- * del derivations
- *
- * def sample(self, unsigned n): # <<<<<<<<<<<<<<
- * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
- * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
@@ -11259,18 +12320,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_30sample(struct __pyx_obj_4c
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_sample, __pyx_n_s_Hypergraph_sample); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -11281,11 +12340,20 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
{
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- std::vector<HypergraphSampler::Hypothesis> *__pyx_t_1;
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_t_1;
size_t __pyx_t_2;
unsigned int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11301,7 +12369,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":147
+ /* "cdec/hypergraph.pxi":147
* def sample(self, unsigned n):
* """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
* cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
@@ -11309,14 +12377,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
* cdef unsigned k
*/
try {
- __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis>();
+ __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis> ();
} catch(...) {
__Pyx_CppExn2PyErr();
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_cur_scope->__pyx_v_hypos = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":148
+ /* "cdec/hypergraph.pxi":148
* """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) # <<<<<<<<<<<<<<
@@ -11325,7 +12393,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
*/
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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":150
+ /* "cdec/hypergraph.pxi":150
* hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11334,7 +12402,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":151
+ /* "cdec/hypergraph.pxi":151
* cdef unsigned k
* try:
* for k in range(hypos.size()): # <<<<<<<<<<<<<<
@@ -11345,26 +12413,26 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":152
+ /* "cdec/hypergraph.pxi":152
* try:
* for k in range(hypos.size()):
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del hypos
*/
- __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -11377,44 +12445,65 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
__pyx_L9_resume_from_yield:;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":154
+ /* "cdec/hypergraph.pxi":154
* yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
* finally:
* del hypos # <<<<<<<<<<<<<<
*
- * def sample_trees(self, unsigned n):
+ * def sample_hypotheses(self, unsigned n):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_hypos;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_hypos;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_hypos;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
}
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":145
+ * del derivations
+ *
+ * def sample(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample(n) -> Sample of n hypotheses from the hypergraph."""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11430,32 +12519,311 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_32generator10(__pyx_Generato
}
static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+/* "cdec/hypergraph.pxi":156
+ * del hypos
+ *
+ * def sample_hypotheses(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.
+ * Generates (sample_string, dot, fmap)"""
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_hypotheses(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_hypotheses[] = "hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.\n Generates (sample_string, dot, fmap)";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_hypotheses(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
unsigned int __pyx_v_n;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("sample_trees (wrapper)", 0);
+ __Pyx_RefNannySetupContext("sample_hypotheses (wrapper)", 0);
assert(__pyx_arg_n); {
- __pyx_v_n = __Pyx_PyInt_AsUnsignedInt(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
- __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_hypotheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_hypotheses(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_hypotheses(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("sample_hypotheses", 0);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
+ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __pyx_cur_scope->__pyx_v_n = __pyx_v_n;
+ {
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_sample_hypotheses, __pyx_n_s_Hypergraph_sample_hypotheses); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_cur_scope);
+ __Pyx_RefNannyFinishContext();
+ return (PyObject *) gen;
+ }
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_hypotheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":156
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ std::vector<HypergraphSampler::Hypothesis> *__pyx_t_1;
+ size_t __pyx_t_2;
+ unsigned int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ char const *__pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L9_resume_from_yield;
+ default: /* CPython raises the right error here */
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __pyx_L3_first_run:;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/hypergraph.pxi":159
+ * """hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.
+ * Generates (sample_string, dot, fmap)"""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = None
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
+ */
+ try {
+ __pyx_t_1 = new std::vector<HypergraphSampler::Hypothesis> ();
+ } catch(...) {
+ __Pyx_CppExn2PyErr();
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __pyx_cur_scope->__pyx_v_hypos = __pyx_t_1;
+
+ /* "cdec/hypergraph.pxi":160
+ * Generates (sample_string, dot, fmap)"""
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ * cdef SparseVector fmap = None # <<<<<<<<<<<<<<
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
+ * cdef unsigned k
+ */
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None);
+
+ /* "cdec/hypergraph.pxi":161
+ * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ * cdef SparseVector fmap = None
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<<
+ * cdef unsigned k
+ * try:
+ */
+ HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((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);
+
+ /* "cdec/hypergraph.pxi":163
+ * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
+ * cdef unsigned k
+ * try: # <<<<<<<<<<<<<<
+ * for k in range(hypos.size()):
+ * fmap = SparseVector.__new__(SparseVector)
+ */
+ /*try:*/ {
+
+ /* "cdec/hypergraph.pxi":164
+ * cdef unsigned k
+ * try:
+ * for k in range(hypos.size()): # <<<<<<<<<<<<<<
+ * fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](hypos[0][k].fmap)
+ */
+ __pyx_t_2 = __pyx_cur_scope->__pyx_v_hypos->size();
+ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+ __pyx_cur_scope->__pyx_v_k = __pyx_t_3;
+
+ /* "cdec/hypergraph.pxi":165
+ * try:
+ * for k in range(hypos.size()):
+ * fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
+ * fmap.vector = new FastSparseVector[weight_t](hypos[0][k].fmap)
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8'), hypos[0][k].model_score.as_float(), fmap
+ */
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_fmap, ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4));
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "cdec/hypergraph.pxi":166
+ * for k in range(hypos.size()):
+ * fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](hypos[0][k].fmap) # <<<<<<<<<<<<<<
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8'), hypos[0][k].model_score.as_float(), fmap
+ * finally:
+ */
+ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector<weight_t> (((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).fmap);
+
+ /* "cdec/hypergraph.pxi":167
+ * fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](hypos[0][k].fmap)
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8'), hypos[0][k].model_score.as_float(), fmap # <<<<<<<<<<<<<<
+ * finally:
+ * del hypos
+ */
+ __pyx_t_4 = __Pyx_PyBytes_FromString(TD::GetString(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).words).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyFloat_FromDouble(((__pyx_cur_scope->__pyx_v_hypos[0])[__pyx_cur_scope->__pyx_v_k]).model_score.as_float()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap));
+ __pyx_t_4 = 0;
+ __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L9_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ }
+ }
+
+ /* "cdec/hypergraph.pxi":169
+ * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8'), hypos[0][k].model_score.as_float(), fmap
+ * finally:
+ * del hypos # <<<<<<<<<<<<<<
+ *
+ * def sample_trees(self, unsigned n):
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_hypos;
+ goto __pyx_L6;
+ }
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __Pyx_XGOTREF(__pyx_t_15);
+ __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_hypos;
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_XGIVEREF(__pyx_t_15);
+ __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
+ }
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
+ __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
+ goto __pyx_L1_error;
+ }
+ __pyx_L6:;
+ }
+
+ /* "cdec/hypergraph.pxi":156
+ * del hypos
+ *
+ * def sample_hypotheses(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.
+ * Generates (sample_string, dot, fmap)"""
+ */
+
+ /* function exit code */
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("sample_hypotheses", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_38generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":171
* del hypos
*
* def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
@@ -11463,15 +12831,42 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees(PyObject *__p
* cdef vector[string]* trees = new vector[string]()
*/
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_cur_scope;
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_36sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
+ unsigned int __pyx_v_n;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("sample_trees (wrapper)", 0);
+ assert(__pyx_arg_n); {
+ __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_36sample_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36sample_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sample_trees", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16_sample_trees, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -11482,33 +12877,40 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33sample_trees(struct __pyx_
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_n = __pyx_v_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_38generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_sample_trees, __pyx_n_s_Hypergraph_sample_trees); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_38generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
- std::vector<std::string> *__pyx_t_1;
+ std::vector<std::string> *__pyx_t_1;
size_t __pyx_t_2;
unsigned int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_t_7;
+ char const *__pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -11522,9 +12924,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":158
+ /* "cdec/hypergraph.pxi":173
* def sample_trees(self, unsigned n):
* """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
* cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<<
@@ -11532,14 +12934,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
* cdef unsigned k
*/
try {
- __pyx_t_1 = new std::vector<std::string>();
+ __pyx_t_1 = new std::vector<std::string> ();
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_cur_scope->__pyx_v_trees = __pyx_t_1;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":159
+ /* "cdec/hypergraph.pxi":174
* """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) # <<<<<<<<<<<<<<
@@ -11548,7 +12950,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
*/
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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":161
+ /* "cdec/hypergraph.pxi":176
* hypergraph.sample_trees(self.hg[0], n, self._rng(), trees)
* cdef unsigned k
* try: # <<<<<<<<<<<<<<
@@ -11557,7 +12959,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
*/
/*try:*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":162
+ /* "cdec/hypergraph.pxi":177
* cdef unsigned k
* try:
* for k in range(trees.size()): # <<<<<<<<<<<<<<
@@ -11568,26 +12970,26 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":163
+ /* "cdec/hypergraph.pxi":178
* try:
* for k in range(trees.size()):
* yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<<
* finally:
* del trees
*/
- __pyx_t_4 = __Pyx_PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(((__pyx_cur_scope->__pyx_v_trees[0])[__pyx_cur_scope->__pyx_v_k]).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
@@ -11600,11 +13002,11 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
__pyx_L9_resume_from_yield:;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
}
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":165
+ /* "cdec/hypergraph.pxi":180
* yield unicode(trees[0][k].c_str(), 'utf8')
* finally:
* del trees # <<<<<<<<<<<<<<
@@ -11612,32 +13014,53 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
* def intersect(self, inp):
*/
/*finally:*/ {
- int __pyx_why;
- PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
- int __pyx_exc_lineno;
- __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
- __pyx_why = 0; goto __pyx_L6;
- __pyx_L5: {
- __pyx_why = 4;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
- __pyx_exc_lineno = __pyx_lineno;
+ /*normal exit:*/{
+ delete __pyx_cur_scope->__pyx_v_trees;
goto __pyx_L6;
}
- __pyx_L6:;
- delete __pyx_cur_scope->__pyx_v_trees;
- switch (__pyx_why) {
- case 4: {
- __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
- __pyx_lineno = __pyx_exc_lineno;
- __pyx_exc_type = 0;
- __pyx_exc_value = 0;
- __pyx_exc_tb = 0;
- goto __pyx_L1_error;
+ /*exception exit:*/{
+ __pyx_L5_error:;
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __Pyx_XGOTREF(__pyx_t_13);
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename;
+ {
+ delete __pyx_cur_scope->__pyx_v_trees;
}
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_XGIVEREF(__pyx_t_13);
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
+ }
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
+ __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0;
+ __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8;
+ goto __pyx_L1_error;
}
+ __pyx_L6:;
}
+
+ /* "cdec/hypergraph.pxi":171
+ * del hypos
+ *
+ * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<<
+ * """hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
+ * cdef vector[string]* trees = new vector[string]()
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11652,27 +13075,29 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_35generator11(__pyx_Generato
return NULL;
}
+/* "cdec/hypergraph.pxi":182
+ * del trees
+ *
+ * def intersect(self, inp): # <<<<<<<<<<<<<<
+ * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
+ * cdef Lattice lat
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_36intersect[] = "hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_40intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_39intersect[] = "hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_40intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("intersect (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_39intersect(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":167
- * del trees
- *
- * def intersect(self, inp): # <<<<<<<<<<<<<<
- * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
- * cdef Lattice lat
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp) {
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_39intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp) {
struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_lat = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -11685,7 +13110,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":170
+ /* "cdec/hypergraph.pxi":185
* """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
* cdef Lattice lat
* if isinstance(inp, Lattice): # <<<<<<<<<<<<<<
@@ -11696,19 +13121,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":171
+ /* "cdec/hypergraph.pxi":186
* cdef Lattice lat
* if isinstance(inp, Lattice):
* lat = <Lattice> inp # <<<<<<<<<<<<<<
* elif isinstance(inp, basestring):
* lat = Lattice(inp)
*/
- __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_inp)));
- __pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_inp);
+ __pyx_t_3 = __pyx_v_inp;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":172
+ /* "cdec/hypergraph.pxi":187
* if isinstance(inp, Lattice):
* lat = <Lattice> inp
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
@@ -11719,51 +13146,51 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":173
+ /* "cdec/hypergraph.pxi":188
* lat = <Lattice> inp
* elif isinstance(inp, basestring):
* lat = Lattice(inp) # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp))
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __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 = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_inp);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_inp);
__Pyx_GIVEREF(__pyx_v_inp);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":175
+ /* "cdec/hypergraph.pxi":190
* lat = Lattice(inp)
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<<
* return hypergraph.Intersect(lat.lattice[0], self.hg)
*
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_intersect_hypergraph_with, ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":176
+ /* "cdec/hypergraph.pxi":191
* else:
* raise TypeError('cannot intersect hypergraph with %s' % type(inp))
* return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<<
@@ -11771,14 +13198,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
* def prune(self, beam_alpha=0, density=0, **kwargs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBool_FromLong(HG::Intersect((__pyx_v_lat->lattice[0]), __pyx_v_self->hg)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":182
+ * del trees
+ *
+ * def intersect(self, inp): # <<<<<<<<<<<<<<
+ * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."""
+ * cdef Lattice lat
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
@@ -11791,10 +13225,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_36intersect(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":193
+ * return hypergraph.Intersect(lat.lattice[0], self.hg)
+ *
+ * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
+ * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
+ * beam_alpha: use beam pruning
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_38prune[] = "hg.prune(beam_alpha=0, density=0): Prune the hypergraph.\n beam_alpha: use beam pruning\n density: use density pruning";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_42prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_41prune[] = "hg.prune(beam_alpha=0, density=0): Prune the hypergraph.\n beam_alpha: use beam pruning\n density: use density pruning";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_42prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_beam_alpha = 0;
PyObject *__pyx_v_density = 0;
PyObject *__pyx_v_kwargs = 0;
@@ -11807,7 +13249,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
__pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__beam_alpha,&__pyx_n_s__density,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_beam_alpha,&__pyx_n_s_density,0};
PyObject* values[2] = {0,0};
values[0] = ((PyObject *)__pyx_int_0);
values[1] = ((PyObject *)__pyx_int_0);
@@ -11824,17 +13266,17 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beam_alpha);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_beam_alpha);
if (value) { values[0] = value; kw_args--; }
}
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__density);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_density);
if (value) { values[1] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "prune") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -11849,28 +13291,22 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune(PyObject *__pyx_v_se
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs);
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_41prune(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs);
+
+ /* function exit code */
__Pyx_XDECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":178
- * return hypergraph.Intersect(lat.lattice[0], self.hg)
- *
- * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
- * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
- * beam_alpha: use beam pruning
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) {
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_41prune(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) {
std::vector<bool> *__pyx_v_preserve_mask;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -11883,7 +13319,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("prune", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":182
+ /* "cdec/hypergraph.pxi":197
* beam_alpha: use beam pruning
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<<
@@ -11892,18 +13328,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
*/
__pyx_v_preserve_mask = NULL;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":183
+ /* "cdec/hypergraph.pxi":198
* density: use density pruning"""
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<<
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
*/
- __pyx_t_1 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s_16), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PyDict_Contains(__pyx_n_s_csplit_preserve_full_word, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":184
+ /* "cdec/hypergraph.pxi":199
* cdef hypergraph.EdgeMask* preserve_mask = NULL
* if 'csplit_preserve_full_word' in kwargs:
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<<
@@ -11912,7 +13348,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
*/
__pyx_v_preserve_mask = new std::vector<bool>(__pyx_v_self->hg->edges_.size());
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":185
+ /* "cdec/hypergraph.pxi":200
* 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 # <<<<<<<<<<<<<<
@@ -11924,18 +13360,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":186
+ /* "cdec/hypergraph.pxi":201
* preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size())
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) # <<<<<<<<<<<<<<
* if preserve_mask:
* del preserve_mask
*/
- __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_beam_alpha); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 201; __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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":187
+ /* "cdec/hypergraph.pxi":202
* preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask: # <<<<<<<<<<<<<<
@@ -11945,7 +13381,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
__pyx_t_2 = (__pyx_v_preserve_mask != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":188
+ /* "cdec/hypergraph.pxi":203
* self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False)
* if preserve_mask:
* del preserve_mask # <<<<<<<<<<<<<<
@@ -11957,6 +13393,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
}
__pyx_L4:;
+ /* "cdec/hypergraph.pxi":193
+ * return hypergraph.Intersect(lat.lattice[0], self.hg)
+ *
+ * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<<
+ * """hg.prune(beam_alpha=0, density=0): Prune the hypergraph.
+ * beam_alpha: use beam pruning
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -11968,27 +13413,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_38prune(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":205
+ * del preserve_mask
+ *
+ * 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()
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_40lattice[] = "hg.lattice() -> Lattice corresponding to the hypergraph.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_44lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_43lattice[] = "hg.lattice() -> Lattice corresponding to the hypergraph.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_44lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lattice (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_43lattice(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":190
- * del preserve_mask
- *
- * 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()
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_43lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_v_plf = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12000,19 +13447,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lattice", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":192
+ /* "cdec/hypergraph.pxi":207
* 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() # <<<<<<<<<<<<<<
* return Lattice(eval(plf))
*
*/
- __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_v_plf = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":193
+ /* "cdec/hypergraph.pxi":208
* """hg.lattice() -> Lattice corresponding to the hypergraph."""
* cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str()
* return Lattice(eval(plf)) # <<<<<<<<<<<<<<
@@ -12020,44 +13467,51 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
* def plf(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- if (((PyObject *)__pyx_v_plf)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__plf), ((PyObject *)__pyx_v_plf)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (__pyx_v_plf) {
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_plf, __pyx_v_plf) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (((PyObject *)__pyx_v_self)) {
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_self, ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(((PyObject *)__pyx_v_plf));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_plf));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_plf));
- PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_t_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
+ __Pyx_INCREF(__pyx_v_plf);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_plf);
+ __Pyx_GIVEREF(__pyx_v_plf);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_eval, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_eval, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":205
+ * del preserve_mask
+ *
+ * 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()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12071,27 +13525,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_40lattice(struct __pyx_obj_4
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":210
+ * return Lattice(eval(plf))
+ *
+ * def plf(self): # <<<<<<<<<<<<<<
+ * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_42plf[] = "hg.plf() -> Lattice PLF representation corresponding to the hypergraph.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_46plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_45plf[] = "hg.plf() -> Lattice PLF representation corresponding to the hypergraph.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_46plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("plf (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_45plf(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":195
- * return Lattice(eval(plf))
- *
- * def plf(self): # <<<<<<<<<<<<<<
- * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
- * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_45plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -12101,7 +13557,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("plf", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":197
+ /* "cdec/hypergraph.pxi":212
* def plf(self):
* """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
* return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -12109,22 +13565,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
* def reweight(self, weights):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->hg[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":210
+ * return Lattice(eval(plf))
+ *
+ * def plf(self): # <<<<<<<<<<<<<<
+ * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph."""
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12136,27 +13599,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_42plf(struct __pyx_obj_4cdec
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":214
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
+ * def reweight(self, weights): # <<<<<<<<<<<<<<
+ * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
+ * if isinstance(weights, SparseVector):
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_44reweight[] = "hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_48reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_47reweight[] = "hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_48reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reweight (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_47reweight(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":199
- * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
- *
- * def reweight(self, weights): # <<<<<<<<<<<<<<
- * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
- * if isinstance(weights, SparseVector):
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_47reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -12168,7 +13633,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reweight", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":201
+ /* "cdec/hypergraph.pxi":216
* def reweight(self, weights):
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector): # <<<<<<<<<<<<<<
@@ -12179,7 +13644,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":202
+ /* "cdec/hypergraph.pxi":217
* """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -12190,7 +13655,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":203
+ /* "cdec/hypergraph.pxi":218
* if isinstance(weights, SparseVector):
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<<
@@ -12201,7 +13666,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":204
+ /* "cdec/hypergraph.pxi":219
* self.hg.Reweight((<SparseVector> weights).vector[0])
* elif isinstance(weights, DenseVector):
* self.hg.Reweight((<DenseVector> weights).vector[0]) # <<<<<<<<<<<<<<
@@ -12213,29 +13678,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":206
+ /* "cdec/hypergraph.pxi":221
* self.hg.Reweight((<DenseVector> weights).vector[0])
* else:
* raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<<
*
* property edges:
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_cannot_reweight_hypergraph_with, ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[3]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
+ /* "cdec/hypergraph.pxi":214
+ * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str())
+ *
+ * def reweight(self, weights): # <<<<<<<<<<<<<<
+ * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."""
+ * if isinstance(weights, SparseVector):
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12248,7 +13722,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_44reweight(struct __pyx_obj_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":224
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -12257,27 +13739,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":209
- *
- * property edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -12287,27 +13763,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_Hypergraph___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -12326,9 +13800,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":211
+ /* "cdec/hypergraph.pxi":226
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<<
@@ -12339,16 +13813,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":212
+ /* "cdec/hypergraph.pxi":227
* cdef unsigned i
* for i in range(self.hg.edges_.size()):
* yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property nodes:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __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_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_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_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __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;
@@ -12363,8 +13837,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/hypergraph.pxi":224
+ *
+ * property edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12378,7 +13862,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator12(__pyx_Ge
__Pyx_RefNannyFinishContext();
return NULL;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":230
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -12387,27 +13879,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":215
- *
- * property nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.hg.nodes_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -12417,27 +13903,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_Hypergraph___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Hypergraph.nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -12456,9 +13940,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":217
+ /* "cdec/hypergraph.pxi":232
* def __get__(self):
* cdef unsigned i
* for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<<
@@ -12469,16 +13953,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":218
+ /* "cdec/hypergraph.pxi":233
* cdef unsigned i
* for i in range(self.hg.nodes_.size()):
* yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<<
*
* property goal:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __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;
@@ -12493,8 +13977,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/hypergraph.pxi":230
+ *
+ * property nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.hg.nodes_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -12509,6 +14003,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator13(__pyx_Ge
return NULL;
}
+/* "cdec/hypergraph.pxi":236
+ *
+ * property goal:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self) {
@@ -12516,18 +14018,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":221
- *
- * property goal:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return HypergraphNode().init(self.hg, self.hg.GoalNode())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12538,7 +14034,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":222
+ /* "cdec/hypergraph.pxi":237
* property goal:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<<
@@ -12546,17 +14042,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
* property npaths:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":236
+ *
+ * property goal:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.hg.GoalNode())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12568,6 +14071,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(struct __pyx_o
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":240
+ *
+ * property npaths:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.hg.NumberOfPaths()
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self) {
@@ -12575,18 +14086,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":225
- *
- * property npaths:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.hg.NumberOfPaths()
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12596,7 +14101,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":226
+ /* "cdec/hypergraph.pxi":241
* property npaths:
* def __get__(self):
* return self.hg.NumberOfPaths() # <<<<<<<<<<<<<<
@@ -12604,14 +14109,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
* def inside_outside(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->hg->NumberOfPaths()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 241; __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;
+ /* "cdec/hypergraph.pxi":240
+ *
+ * property npaths:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.hg.NumberOfPaths()
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.npaths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12622,31 +14134,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(struct __pyx
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":243
+ * return self.hg.NumberOfPaths()
+ *
+ * def inside_outside(self): # <<<<<<<<<<<<<<
+ * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
+ * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static char __pyx_doc_4cdec_5_cdec_10Hypergraph_46inside_outside[] = "hg.inside_outside() -> SparseVector with inside-outside scores for each feature.";
-static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_50inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static char __pyx_doc_4cdec_5_cdec_10Hypergraph_49inside_outside[] = "hg.inside_outside() -> SparseVector with inside-outside scores for each feature.";
+static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_50inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inside_outside (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_49inside_outside(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":228
- * return self.hg.NumberOfPaths()
- *
- * def inside_outside(self): # <<<<<<<<<<<<<<
- * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
- * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
- FastSparseVector<prob_t> *__pyx_v_result;
+static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_49inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) {
+ FastSparseVector<prob_t> *__pyx_v_result;
prob_t __pyx_v_z;
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
- FastSparseVector<prob_t>::const_iterator *__pyx_v_it;
+ FastSparseVector<prob_t> ::const_iterator *__pyx_v_it;
CYTHON_UNUSED unsigned int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12658,16 +14172,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("inside_outside", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":230
+ /* "cdec/hypergraph.pxi":245
* def inside_outside(self):
* """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)
* result[0] /= z
*/
- __pyx_v_result = new FastSparseVector<prob_t>();
+ __pyx_v_result = new FastSparseVector<prob_t> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":231
+ /* "cdec/hypergraph.pxi":246
* """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) # <<<<<<<<<<<<<<
@@ -12676,7 +14190,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
__pyx_v_z = InsideOutside<prob_t, EdgeProb, SparseVector<prob_t>, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":232
+ /* "cdec/hypergraph.pxi":247
* cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z # <<<<<<<<<<<<<<
@@ -12685,38 +14199,38 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
(__pyx_v_result[0]) /= __pyx_v_z;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":233
+ /* "cdec/hypergraph.pxi":248
* cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result)
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double]()
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":234
+ /* "cdec/hypergraph.pxi":249
* result[0] /= z
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<<
* cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False)
* cdef unsigned i
*/
- __pyx_v_vector->vector = new FastSparseVector<double>();
+ __pyx_v_vector->vector = new FastSparseVector<double> ();
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":235
+ /* "cdec/hypergraph.pxi":250
* 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) # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(result.size()):
*/
- __pyx_v_it = new FastSparseVector<prob_t>::const_iterator((__pyx_v_result[0]), 0);
+ __pyx_v_it = new FastSparseVector<prob_t> ::const_iterator((__pyx_v_result[0]), 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":237
+ /* "cdec/hypergraph.pxi":252
* 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()): # <<<<<<<<<<<<<<
@@ -12727,7 +14241,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":238
+ /* "cdec/hypergraph.pxi":253
* cdef unsigned i
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<<
@@ -12736,7 +14250,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
__pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":239
+ /* "cdec/hypergraph.pxi":254
* for i in range(result.size()):
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it # <<<<<<<<<<<<<<
@@ -12746,7 +14260,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
(++(__pyx_v_it[0]));
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":240
+ /* "cdec/hypergraph.pxi":255
* vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second))
* pinc(it[0]) # ++it
* del it # <<<<<<<<<<<<<<
@@ -12755,7 +14269,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
delete __pyx_v_it;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":241
+ /* "cdec/hypergraph.pxi":256
* pinc(it[0]) # ++it
* del it
* del result # <<<<<<<<<<<<<<
@@ -12764,7 +14278,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
*/
delete __pyx_v_result;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":242
+ /* "cdec/hypergraph.pxi":257
* del it
* del result
* return vector # <<<<<<<<<<<<<<
@@ -12776,8 +14290,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
__pyx_r = ((PyObject *)__pyx_v_vector);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":243
+ * return self.hg.NumberOfPaths()
+ *
+ * def inside_outside(self): # <<<<<<<<<<<<<<
+ * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature."""
+ * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]()
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Hypergraph.inside_outside", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12789,7 +14310,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_46inside_outside(struct __py
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":249
+/* "cdec/hypergraph.pxi":264
* cdef public TRule trule
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -12806,7 +14327,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":250
+ /* "cdec/hypergraph.pxi":265
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -12815,7 +14336,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":251
+ /* "cdec/hypergraph.pxi":266
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.edge = &hg.edges_[i] # <<<<<<<<<<<<<<
@@ -12824,32 +14345,32 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
*/
__pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":252
+ /* "cdec/hypergraph.pxi":267
* self.hg = hg
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule) # <<<<<<<<<<<<<<
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->trule);
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
__pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":253
+ /* "cdec/hypergraph.pxi":268
* self.edge = &hg.edges_[i]
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<<
* return self
*
*/
- __pyx_v_self->trule->rule = new boost::shared_ptr<TRule>(__pyx_v_self->edge->rule_);
+ __pyx_v_self->trule->rule = new boost::shared_ptr<TRule> (__pyx_v_self->edge->rule_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":254
+ /* "cdec/hypergraph.pxi":269
* self.trule = TRule.__new__(TRule)
* self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_)
* return self # <<<<<<<<<<<<<<
@@ -12861,8 +14382,15 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":264
+ * cdef public TRule trule
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.edge = &hg.edges_[i]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -12873,6 +14401,14 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphEdge_init(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":271
+ * return self
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.edge.tail_nodes_.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self) {
@@ -12880,24 +14416,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":256
- * return self
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.edge.tail_nodes_.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":257
+ /* "cdec/hypergraph.pxi":272
*
* def __len__(self):
* return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<<
@@ -12907,12 +14437,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(struct __pyx_ob
__pyx_r = __pyx_v_self->edge->tail_nodes_.size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/hypergraph.pxi":271
+ * return self
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.edge.tail_nodes_.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":275
+ *
+ * property head_node:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.edge.head_node_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self) {
@@ -12920,18 +14466,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":260
- *
- * property head_node:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return HypergraphNode().init(self.hg, self.edge.head_node_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -12942,7 +14482,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":261
+ /* "cdec/hypergraph.pxi":276
* property head_node:
* def __get__(self):
* return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<<
@@ -12950,17 +14490,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
* property tail_nodes:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":275
+ *
+ * property head_node:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return HypergraphNode().init(self.hg, self.edge.head_node_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -12971,7 +14518,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(struc
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":279
+ *
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -12980,27 +14535,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(Py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":264
- *
- * property tail_nodes:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.edge.tail_nodes_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -13010,27 +14559,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(str
__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_14HypergraphEdge_10tail_nodes_2generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphEdge___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.tail_nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
unsigned int __pyx_t_1;
unsigned int __pyx_t_2;
@@ -13049,9 +14596,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":266
+ /* "cdec/hypergraph.pxi":281
* def __get__(self):
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<<
@@ -13062,16 +14609,16 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":267
+ /* "cdec/hypergraph.pxi":282
* cdef unsigned i
* for i in range(self.edge.tail_nodes_.size()):
* yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<<
*
* property span:
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphNode)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *)((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __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;
@@ -13086,8 +14633,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
__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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/hypergraph.pxi":279
+ *
+ * property tail_nodes:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.edge.tail_nodes_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13102,6 +14659,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator1
return NULL;
}
+/* "cdec/hypergraph.pxi":285
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.i_, self.edge.j_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self) {
@@ -13109,18 +14674,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":270
- *
- * property span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return (self.edge.i_, self.edge.j_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13132,7 +14691,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":271
+ /* "cdec/hypergraph.pxi":286
* property span:
* def __get__(self):
* return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<<
@@ -13140,11 +14699,11 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
* property src_span:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_short(__pyx_v_self->edge->i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->edge->j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -13152,12 +14711,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":285
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.i_, self.edge.j_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -13170,6 +14736,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __p
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":289
+ *
+ * property src_span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.prev_i_, self.edge.prev_j_)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self) {
@@ -13177,18 +14751,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":274
- *
- * property src_span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return (self.edge.prev_i_, self.edge.prev_j_)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13200,7 +14768,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":275
+ /* "cdec/hypergraph.pxi":290
* property src_span:
* def __get__(self):
* return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<<
@@ -13208,11 +14776,11 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
* property feature_values:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_self->edge->prev_i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_short(__pyx_v_self->edge->prev_i_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_self->edge->prev_j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->edge->prev_j_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -13220,12 +14788,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_r = ((PyObject *)__pyx_t_3);
+ __pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":289
+ *
+ * property src_span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return (self.edge.prev_i_, self.edge.prev_j_)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -13238,6 +14813,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":293
+ *
+ * property feature_values:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector = SparseVector.__new__(SparseVector)
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self) {
@@ -13245,18 +14828,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":278
- *
- * property feature_values:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector vector = SparseVector.__new__(SparseVector)
- * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0;
PyObject *__pyx_r = NULL;
@@ -13267,29 +14844,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":279
+ /* "cdec/hypergraph.pxi":294
* property feature_values:
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":280
+ /* "cdec/hypergraph.pxi":295
* def __get__(self):
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<<
* return vector
*
*/
- __pyx_v_vector->vector = new FastSparseVector<double>(__pyx_v_self->edge->feature_values_);
+ __pyx_v_vector->vector = new FastSparseVector<double> (__pyx_v_self->edge->feature_values_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":281
+ /* "cdec/hypergraph.pxi":296
* cdef SparseVector vector = SparseVector.__new__(SparseVector)
* vector.vector = new FastSparseVector[double](self.edge.feature_values_)
* return vector # <<<<<<<<<<<<<<
@@ -13301,8 +14878,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
__pyx_r = ((PyObject *)__pyx_v_vector);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":293
+ *
+ * property feature_values:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector vector = SparseVector.__new__(SparseVector)
+ * vector.vector = new FastSparseVector[double](self.edge.feature_values_)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.feature_values.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13314,6 +14898,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":299
+ *
+ * property prob:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.edge.edge_prob_.as_float()
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self) {
@@ -13321,18 +14913,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":284
- *
- * property prob:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.edge.edge_prob_.as_float()
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13342,7 +14928,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":285
+ /* "cdec/hypergraph.pxi":300
* property prob:
* def __get__(self):
* return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<<
@@ -13350,14 +14936,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->edge->edge_prob_.as_float()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 300; __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;
+ /* "cdec/hypergraph.pxi":299
+ *
+ * property prob:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.edge.edge_prob_.as_float()
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13368,6 +14961,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __p
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":302
+ * return self.edge.edge_prob_.as_float()
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -13377,9 +14978,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__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_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_y), ((int)__pyx_v_op));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -13388,14 +14991,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":287
- * return self.edge.edge_prob_.as_float()
- *
- * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.edge == y.edge
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_x, struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13406,7 +15001,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":290
+ /* "cdec/hypergraph.pxi":305
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -13415,7 +15010,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":288
+ /* "cdec/hypergraph.pxi":303
*
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -13424,7 +15019,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":289
+ /* "cdec/hypergraph.pxi":304
* def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op):
* if op == 2: # ==
* return x.edge == y.edge # <<<<<<<<<<<<<<
@@ -13432,14 +15027,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
* return not (x == y)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_x->edge == __pyx_v_y->edge)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 304; __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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":290
+ /* "cdec/hypergraph.pxi":305
* if op == 2: # ==
* return x.edge == y.edge
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -13448,7 +15043,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":291
+ /* "cdec/hypergraph.pxi":306
* return x.edge == y.edge
* elif op == 3: # !=
* return not (x == y) # <<<<<<<<<<<<<<
@@ -13456,32 +15051,40 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
*
*/
__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 = 291; __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 = 291; __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 = 306; __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 = 306; __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 = 291; __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 = 306; __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;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":292
+ /* "cdec/hypergraph.pxi":307
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplemented, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 307; __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 = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":302
+ * return self.edge.edge_prob_.as_float()
+ *
+ * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.edge == y.edge
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13492,6 +15095,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_2__richcmp__(struct __py
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":262
+ * cdef hypergraph.Hypergraph* hg
+ * cdef hypergraph.HypergraphEdge* edge
+ * cdef public TRule trule # <<<<<<<<<<<<<<
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self) {
@@ -13499,18 +15110,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":247
- * cdef hypergraph.Hypergraph* hg
- * cdef hypergraph.HypergraphEdge* edge
- * cdef public TRule trule # <<<<<<<<<<<<<<
- *
- * cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13520,7 +15125,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __
__pyx_r = ((PyObject *)__pyx_v_self->trule);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -13534,6 +15139,8 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -13541,20 +15148,25 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__py
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) {
int __pyx_r;
__Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__set__", 0);
- if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
+ if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_v_value;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->trule);
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
- __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_value);
+ __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1);
+ __pyx_t_1 = 0;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphEdge.trule.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -13569,6 +15181,8 @@ static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -13583,12 +15197,13 @@ static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_o
__Pyx_DECREF(((PyObject *)__pyx_v_self->trule));
__pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None);
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":298
+/* "cdec/hypergraph.pxi":313
* cdef hypergraph.HypergraphNode* node
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
@@ -13601,7 +15216,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("init", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":299
+ /* "cdec/hypergraph.pxi":314
*
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg # <<<<<<<<<<<<<<
@@ -13610,7 +15225,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
*/
__pyx_v_self->hg = __pyx_v_hg;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":300
+ /* "cdec/hypergraph.pxi":315
* cdef init(self, hypergraph.Hypergraph* hg, unsigned i):
* self.hg = hg
* self.node = &hg.nodes_[i] # <<<<<<<<<<<<<<
@@ -13619,7 +15234,7 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
*/
__pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":301
+ /* "cdec/hypergraph.pxi":316
* self.hg = hg
* self.node = &hg.nodes_[i]
* return self # <<<<<<<<<<<<<<
@@ -13631,13 +15246,29 @@ static PyObject *__pyx_f_4cdec_5_cdec_14HypergraphNode_init(struct __pyx_obj_4cd
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/hypergraph.pxi":313
+ * cdef hypergraph.HypergraphNode* node
+ *
+ * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<<
+ * self.hg = hg
+ * self.node = &hg.nodes_[i]
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":319
+ *
+ * property id:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.node.id_
+ *
+ */
+
/* 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) {
@@ -13645,18 +15276,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_2id_1__get__(PyObject *_
__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));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":304
- *
- * 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
@@ -13666,7 +15291,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":305
+ /* "cdec/hypergraph.pxi":320
* property id:
* def __get__(self):
* return self.node.id_ # <<<<<<<<<<<<<<
@@ -13674,14 +15299,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
* 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 = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->node->id_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 320; __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;
+ /* "cdec/hypergraph.pxi":319
+ *
+ * property id:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.node.id_
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -13691,7 +15323,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_2id___get__(struct __pyx
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":323
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -13700,27 +15340,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":308
- *
- * property in_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.in_edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -13730,27 +15364,25 @@ 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_2generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __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_2generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphNode___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.in_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -13769,9 +15401,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":310
+ /* "cdec/hypergraph.pxi":325
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<<
@@ -13782,16 +15414,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":311
+ /* "cdec/hypergraph.pxi":326
* 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 = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __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 = 311; __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 = 326; __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;
@@ -13806,8 +15438,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
__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 = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/hypergraph.pxi":323
+ *
+ * property in_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.in_edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13821,7 +15463,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator15(_
__Pyx_RefNannyFinishContext();
return NULL;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/hypergraph.pxi":329
+ *
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self); /*proto*/
@@ -13830,27 +15480,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":314
- *
- * property out_edges:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(self.node.out_edges_.size()):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___get__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -13860,27 +15504,25 @@ 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_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __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_2generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_get, __pyx_n_s_HypergraphNode___get); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.out_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
size_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -13899,9 +15541,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":316
+ /* "cdec/hypergraph.pxi":331
* def __get__(self):
* cdef unsigned i
* for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<<
@@ -13912,16 +15554,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":317
+ /* "cdec/hypergraph.pxi":332
* 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 = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 332; __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 = 317; __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 = 332; __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;
@@ -13936,8 +15578,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
__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 = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/hypergraph.pxi":329
+ *
+ * property out_edges:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(self.node.out_edges_.size()):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -13952,6 +15604,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator16(
return NULL;
}
+/* "cdec/hypergraph.pxi":335
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return next(self.in_edges).span
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self) {
@@ -13959,18 +15619,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(PyObject
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":320
- *
- * property span:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return next(self.in_edges).span
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -13981,7 +15635,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":321
+ /* "cdec/hypergraph.pxi":336
* property span:
* def __get__(self):
* return next(self.in_edges).span # <<<<<<<<<<<<<<
@@ -13989,20 +15643,27 @@ 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 = 321; __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 = 336; __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 = 321; __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 = 336; __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 = 321; __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 = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":335
+ *
+ * property span:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return next(self.in_edges).span
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -14014,6 +15675,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __p
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":339
+ *
+ * property cat:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * if self.node.cat_:
+ * return str(TDConvert(-self.node.cat_).c_str())
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self) {
@@ -14021,18 +15690,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":324
- *
- * property cat:
- * def __get__(self): # <<<<<<<<<<<<<<
- * if self.node.cat_:
- * return str(TDConvert(-self.node.cat_).c_str())
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -14044,7 +15707,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":325
+ /* "cdec/hypergraph.pxi":340
* property cat:
* def __get__(self):
* if self.node.cat_: # <<<<<<<<<<<<<<
@@ -14054,7 +15717,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":326
+ /* "cdec/hypergraph.pxi":341
* def __get__(self):
* if self.node.cat_:
* return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<<
@@ -14062,23 +15725,30 @@ 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 = 326; __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 = 326; __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 341; __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));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
+ /* "cdec/hypergraph.pxi":339
+ *
+ * property cat:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * if self.node.cat_:
+ * return str(TDConvert(-self.node.cat_).c_str())
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -14092,6 +15762,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __py
return __pyx_r;
}
+/* "cdec/hypergraph.pxi":343
+ * return str(TDConvert(-self.node.cat_).c_str())
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.node == y.node
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
@@ -14101,9 +15779,11 @@ 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 = 328; __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 = 328; __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 = 343; __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 = 343; __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));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -14112,14 +15792,6 @@ static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__(PyObject *_
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":328
- * return str(TDConvert(-self.node.cat_).c_str())
- *
- * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
- * if op == 2: # ==
- * return x.node == y.node
- */
-
static PyObject *__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) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -14130,7 +15802,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__richcmp__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":331
+ /* "cdec/hypergraph.pxi":346
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -14139,7 +15811,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
switch (__pyx_v_op) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":329
+ /* "cdec/hypergraph.pxi":344
*
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # == # <<<<<<<<<<<<<<
@@ -14148,7 +15820,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
case 2:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":330
+ /* "cdec/hypergraph.pxi":345
* def __richcmp__(HypergraphNode x, HypergraphNode y, int op):
* if op == 2: # ==
* return x.node == y.node # <<<<<<<<<<<<<<
@@ -14156,14 +15828,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 = 330; __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 = 345; __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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":331
+ /* "cdec/hypergraph.pxi":346
* if op == 2: # ==
* return x.node == y.node
* elif op == 3: # != # <<<<<<<<<<<<<<
@@ -14172,37 +15844,45 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
*/
case 3:
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":332
+ /* "cdec/hypergraph.pxi":347
* 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 = 332; __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 = 332; __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 = 347; __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 = 347; __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 = 332; __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 = 347; __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;
+ default: break;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":333
+ /* "cdec/hypergraph.pxi":348
* 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 = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplemented, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 348; __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 = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[3]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/hypergraph.pxi":343
+ * return str(TDConvert(-self.node.cat_).c_str())
+ *
+ * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<<
+ * if op == 2: # ==
+ * return x.node == y.node
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.HypergraphNode.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -14213,6 +15893,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(struct __pyx
return __pyx_r;
}
+/* "cdec/lattice.pxi":6
+ * cdef lattice.Lattice* lattice
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.lattice = new lattice.Lattice()
+ *
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -14223,24 +15911,18 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyO
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":6
- * cdef lattice.Lattice* lattice
- *
- * def __cinit__(self): # <<<<<<<<<<<<<<
- * self.lattice = new lattice.Lattice()
- *
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":7
+ /* "cdec/lattice.pxi":7
*
* def __cinit__(self):
* self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<<
@@ -14249,11 +15931,28 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(struct __pyx_obj_4cdec_5_cde
*/
__pyx_v_self->lattice = new Lattice();
+ /* "cdec/lattice.pxi":6
+ * cdef lattice.Lattice* lattice
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.lattice = new lattice.Lattice()
+ *
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/lattice.pxi":9
+ * self.lattice = new lattice.Lattice()
+ *
+ * def __init__(self, inp): # <<<<<<<<<<<<<<
+ * """Lattice(tuple) -> Lattice from node list.
+ * Lattice(string) -> Lattice from PLF representation."""
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_2__init__[] = "Lattice(tuple) -> Lattice from node list.\n Lattice(string) -> Lattice from PLF representation.";
@@ -14269,7 +15968,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__inp,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -14282,7 +15981,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__inp)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_inp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
@@ -14304,18 +16003,12 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyOb
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":9
- * self.lattice = new lattice.Lattice()
- *
- * def __init__(self, inp): # <<<<<<<<<<<<<<
- * """Lattice(tuple) -> Lattice from node list.
- * Lattice(string) -> Lattice from PLF representation."""
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_arcs = NULL;
@@ -14334,7 +16027,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":12
+ /* "cdec/lattice.pxi":12
* """Lattice(tuple) -> Lattice from node list.
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple): # <<<<<<<<<<<<<<
@@ -14345,7 +16038,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":13
+ /* "cdec/lattice.pxi":13
* Lattice(string) -> Lattice from PLF representation."""
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp)) # <<<<<<<<<<<<<<
@@ -14355,7 +16048,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":14
+ /* "cdec/lattice.pxi":14
* if isinstance(inp, tuple):
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
@@ -14364,67 +16057,76 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_4 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_inp) || PyTuple_CheckExact(__pyx_v_inp)) {
+ if (likely(PyList_CheckExact(__pyx_v_inp)) || PyTuple_CheckExact(__pyx_v_inp)) {
__pyx_t_5 = __pyx_v_inp; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
__pyx_t_6 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_inp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_7 = __pyx_t_6(__pyx_t_5);
if (unlikely(!__pyx_t_7)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_7);
}
- __Pyx_XDECREF(__pyx_v_arcs);
- __pyx_v_arcs = __pyx_t_7;
+ __Pyx_XDECREF_SET(__pyx_v_arcs, __pyx_t_7);
__pyx_t_7 = 0;
__Pyx_INCREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_v_i);
- __pyx_v_i = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4);
__pyx_t_4 = __pyx_t_7;
__pyx_t_7 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":15
+ /* "cdec/lattice.pxi":15
* self.lattice.resize(len(inp))
* for i, arcs in enumerate(inp):
* self[i] = arcs # <<<<<<<<<<<<<<
* elif isinstance(inp, basestring):
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice)
*/
- if (PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_i, __pyx_v_arcs) < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/lattice.pxi":14
+ * if isinstance(inp, tuple):
+ * self.lattice.resize(len(inp))
+ * for i, arcs in enumerate(inp): # <<<<<<<<<<<<<<
+ * self[i] = arcs
+ * elif isinstance(inp, basestring):
+ */
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":16
+ /* "cdec/lattice.pxi":16
* for i, arcs in enumerate(inp):
* self[i] = arcs
* elif isinstance(inp, basestring): # <<<<<<<<<<<<<<
@@ -14435,14 +16137,14 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":17
+ /* "cdec/lattice.pxi":17
* self[i] = arcs
* elif isinstance(inp, basestring):
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice) # <<<<<<<<<<<<<<
* else:
* raise TypeError('cannot create lattice from %s' % type(inp))
*/
- __pyx_t_4 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_inp, NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_inp, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = __pyx_convert_string_from_py_(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -14451,29 +16153,38 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
}
/*else*/ {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":19
+ /* "cdec/lattice.pxi":19
* lattice.ConvertTextOrPLF(as_str(inp), self.lattice)
* else:
* raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_create_lattice_from_s, ((PyObject *)Py_TYPE(__pyx_v_inp))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
+ /* "cdec/lattice.pxi":9
+ * self.lattice = new lattice.Lattice()
+ *
+ * def __init__(self, inp): # <<<<<<<<<<<<<<
+ * """Lattice(tuple) -> Lattice from node list.
+ * Lattice(string) -> Lattice from PLF representation."""
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -14489,28 +16200,30 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(struct __pyx_obj_4cdec_5_cde
return __pyx_r;
}
+/* "cdec/lattice.pxi":21
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.lattice
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":21
- * raise TypeError('cannot create lattice from %s' % type(inp))
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.lattice
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":22
+ /* "cdec/lattice.pxi":22
*
* def __dealloc__(self):
* del self.lattice # <<<<<<<<<<<<<<
@@ -14519,9 +16232,26 @@ static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->lattice;
+ /* "cdec/lattice.pxi":21
+ * raise TypeError('cannot create lattice from %s' % type(inp))
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.lattice
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/lattice.pxi":24
+ * del self.lattice
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
@@ -14533,7 +16263,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -14542,21 +16272,15 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_s
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":24
- * del self.lattice
- *
- * def __getitem__(self, int index): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('lattice index out of range')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) {
PyObject *__pyx_v_arcs = NULL;
- std::vector<LatticeArc> __pyx_v_arc_vector;
+ std::vector<LatticeArc> __pyx_v_arc_vector;
LatticeArc *__pyx_v_arc;
unsigned int __pyx_v_i;
PyObject *__pyx_v_label = NULL;
@@ -14576,7 +16300,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":25
+ /* "cdec/lattice.pxi":25
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -14591,23 +16315,21 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":26
+ /* "cdec/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":27
+ /* "cdec/lattice.pxi":27
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range')
* arcs = [] # <<<<<<<<<<<<<<
@@ -14619,7 +16341,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":28
+ /* "cdec/lattice.pxi":28
* raise IndexError('lattice index out of range')
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<<
@@ -14628,7 +16350,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]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":31
+ /* "cdec/lattice.pxi":31
* cdef lattice.LatticeArc* arc
* cdef unsigned i
* for i in range(arc_vector.size()): # <<<<<<<<<<<<<<
@@ -14639,7 +16361,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":32
+ /* "cdec/lattice.pxi":32
* cdef unsigned i
* for i in range(arc_vector.size()):
* arc = &arc_vector[i] # <<<<<<<<<<<<<<
@@ -14648,7 +16370,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]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":33
+ /* "cdec/lattice.pxi":33
* for i in range(arc_vector.size()):
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<<
@@ -14656,23 +16378,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
* return tuple(arcs)
*/
__pyx_t_4 = __Pyx_PyBytes_FromString(TD::Convert(__pyx_v_arc->label).c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
- __Pyx_XDECREF(((PyObject *)__pyx_v_label));
- __pyx_v_label = ((PyObject*)__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_label, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":34
+ /* "cdec/lattice.pxi":34
* arc = &arc_vector[i]
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<<
@@ -14681,24 +16402,24 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
*/
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_arc->cost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyInt_FromLong(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_arc->dist2next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_INCREF(((PyObject *)__pyx_v_label));
- PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_label));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_label));
+ __Pyx_INCREF(__pyx_v_label);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_label);
+ __Pyx_GIVEREF(__pyx_v_label);
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_4 = 0;
__pyx_t_7 = 0;
- __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_arcs, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
+ __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_arcs, __pyx_t_8); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":35
+ /* "cdec/lattice.pxi":35
* label = unicode(TDConvert(arc.label).c_str(), 'utf8')
* arcs.append((label, arc.cost, arc.dist2next))
* return tuple(arcs) # <<<<<<<<<<<<<<
@@ -14706,14 +16427,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
* def __setitem__(self, int index, tuple arcs):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_8 = ((PyObject *)PyList_AsTuple(__pyx_v_arcs)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_8));
- __pyx_r = ((PyObject *)__pyx_t_8);
+ __pyx_t_8 = PyList_AsTuple(__pyx_v_arcs); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_r = __pyx_t_8;
__pyx_t_8 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/lattice.pxi":24
+ * del self.lattice
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
@@ -14728,6 +16456,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_4c
return __pyx_r;
}
+/* "cdec/lattice.pxi":37
+ * return tuple(arcs)
+ *
+ * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) {
@@ -14739,7 +16475,7 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -14749,6 +16485,8 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -14757,14 +16495,6 @@ static int __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, P
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":37
- * return tuple(arcs)
- *
- * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('lattice index out of range')
- */
-
static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) {
LatticeArc *__pyx_v_arc;
PyObject *__pyx_v_label = NULL;
@@ -14791,7 +16521,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":38
+ /* "cdec/lattice.pxi":38
*
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -14806,34 +16536,32 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":39
+ /* "cdec/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":41
+ /* "cdec/lattice.pxi":41
* raise IndexError('lattice index out of range')
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
* label_str = as_str(label)
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
*/
- if (unlikely(((PyObject *)__pyx_v_arcs) == Py_None)) {
+ if (unlikely(__pyx_v_arcs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = ((PyObject *)__pyx_v_arcs); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
+ __pyx_t_4 = __pyx_v_arcs; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
@@ -14875,8 +16603,7 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
__Pyx_GOTREF(__pyx_t_8);
#endif
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
@@ -14899,42 +16626,38 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
- __Pyx_XDECREF(__pyx_v_label);
- __pyx_v_label = __pyx_t_6;
+ __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_6);
__pyx_t_6 = 0;
- __Pyx_XDECREF(__pyx_v_cost);
- __pyx_v_cost = __pyx_t_7;
+ __Pyx_XDECREF_SET(__pyx_v_cost, __pyx_t_7);
__pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_v_dist2next);
- __pyx_v_dist2next = __pyx_t_8;
+ __Pyx_XDECREF_SET(__pyx_v_dist2next, __pyx_t_8);
__pyx_t_8 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":42
+ /* "cdec/lattice.pxi":42
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
* label_str = as_str(label) # <<<<<<<<<<<<<<
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
*/
- __pyx_t_5 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_label, NULL)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_label, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_XDECREF(((PyObject *)__pyx_v_label_str));
- __pyx_v_label_str = ((PyObject*)__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_label_str, ((PyObject*)__pyx_t_5));
__pyx_t_5 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":43
+ /* "cdec/lattice.pxi":43
* for (label, cost, dist2next) in arcs:
* label_str = as_str(label)
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) # <<<<<<<<<<<<<<
* self.lattice[0][index].push_back(arc[0])
* del arc
*/
- __pyx_t_11 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_label_str)); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_label_str); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_cost); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyInt_As_int(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":44
+ /* "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]) # <<<<<<<<<<<<<<
@@ -14943,7 +16666,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]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":45
+ /* "cdec/lattice.pxi":45
* arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
* self.lattice[0][index].push_back(arc[0])
* del arc # <<<<<<<<<<<<<<
@@ -14951,9 +16674,26 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
* def __len__(self):
*/
delete __pyx_v_arc;
+
+ /* "cdec/lattice.pxi":41
+ * raise IndexError('lattice index out of range')
+ * cdef lattice.LatticeArc* arc
+ * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<<
+ * label_str = as_str(label)
+ * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next)
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ /* "cdec/lattice.pxi":37
+ * return tuple(arcs)
+ *
+ * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('lattice index out of range')
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -14974,6 +16714,14 @@ static int __pyx_pf_4cdec_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_4cdec_5_
return __pyx_r;
}
+/* "cdec/lattice.pxi":47
+ * del arc
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.lattice.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) {
@@ -14981,24 +16729,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":47
- * del arc
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.lattice.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":48
+ /* "cdec/lattice.pxi":48
*
* def __len__(self):
* return self.lattice.size() # <<<<<<<<<<<<<<
@@ -15008,12 +16750,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(struct __pyx_obj_4cde
__pyx_r = __pyx_v_self->lattice->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/lattice.pxi":47
+ * del arc
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.lattice.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/lattice.pxi":50
+ * return self.lattice.size()
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) {
@@ -15021,18 +16779,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_12__str__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":50
- * return self.lattice.size()
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -15043,7 +16795,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":51
+ /* "cdec/lattice.pxi":51
*
* def __str__(self):
* return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<<
@@ -15052,21 +16804,28 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBytes_FromString(HypergraphIO::AsPLF((__pyx_v_self->lattice[0]), 1).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/lattice.pxi":50
+ * return self.lattice.size()
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15078,6 +16837,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec
return __pyx_r;
}
+/* "cdec/lattice.pxi":53
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ * def __unicode__(self): # <<<<<<<<<<<<<<
+ * return unicode(str(self), 'utf8')
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
@@ -15085,18 +16852,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__unicode__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":53
- * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
- *
- * def __unicode__(self): # <<<<<<<<<<<<<<
- * return unicode(str(self), 'utf8')
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -15107,7 +16868,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__unicode__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":54
+ /* "cdec/lattice.pxi":54
*
* def __unicode__(self):
* return unicode(str(self), 'utf8') # <<<<<<<<<<<<<<
@@ -15120,26 +16881,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_n_s__utf8));
- PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__utf8));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__utf8));
+ __Pyx_INCREF(__pyx_n_s_utf8);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_utf8);
+ __Pyx_GIVEREF(__pyx_n_s_utf8);
__pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/lattice.pxi":53
+ * return str(hypergraph.AsPLF(self.lattice[0], True).c_str())
+ *
+ * def __unicode__(self): # <<<<<<<<<<<<<<
+ * return unicode(str(self), 'utf8')
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15150,7 +16918,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/lattice.pxi":56
+ * return unicode(str(self), 'utf8')
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -15159,27 +16935,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":56
- * return unicode(str(self), 'utf8')
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -15189,27 +16959,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(struct __pyx_obj_4cde
__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_7Lattice_18generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_18generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Lattice___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Lattice.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -15229,7 +16997,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":58
+ /* "cdec/lattice.pxi":58
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15240,14 +17008,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":59
+ /* "cdec/lattice.pxi":59
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def todot(self):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -15263,6 +17031,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObj
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/lattice.pxi":56
+ * return unicode(str(self), 'utf8')
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -15276,6 +17054,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator17(__pyx_GeneratorObj
return NULL;
}
+/* "cdec/lattice.pxi":61
+ * yield self[i]
+ *
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_19todot[] = "lattice.todot() -> Representation of the lattice in GraphViz dot format.";
@@ -15284,70 +17070,72 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("todot (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_19todot(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines = {__Pyx_NAMESTR("lines"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines, METH_NOARGS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines = {"lines", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines, METH_NOARGS, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lines (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_self);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
- * def todot(self):
- * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
- * def lines(): # <<<<<<<<<<<<<<
- * yield 'digraph lattice {'
- * yield 'rankdir = LR;'
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lines", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24_lines(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24_lines, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *) __Pyx_CyFunction_GetClosure(__pyx_self);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator24, (PyObject *) __pyx_cur_scope, __pyx_n_s_lines, __pyx_n_s_todot_locals_lines); if (unlikely(!gen)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Lattice.todot.lines", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -15381,15 +17169,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":64
+ /* "cdec/lattice.pxi":64
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines():
* yield 'digraph lattice {' # <<<<<<<<<<<<<<
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
- __pyx_r = ((PyObject *)__pyx_kp_s_26);
+ __Pyx_INCREF(__pyx_kp_s_digraph_lattice);
+ __pyx_r = __pyx_kp_s_digraph_lattice;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15398,15 +17186,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":65
+ /* "cdec/lattice.pxi":65
* def lines():
* yield 'digraph lattice {'
* yield 'rankdir = LR;' # <<<<<<<<<<<<<<
* yield 'node [shape=circle];'
* for i in range(len(self)):
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
- __pyx_r = ((PyObject *)__pyx_kp_s_27);
+ __Pyx_INCREF(__pyx_kp_s_rankdir_LR);
+ __pyx_r = __pyx_kp_s_rankdir_LR;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15415,15 +17203,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":66
+ /* "cdec/lattice.pxi":66
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
* yield 'node [shape=circle];' # <<<<<<<<<<<<<<
* for i in range(len(self)):
* for label, weight, delta in self[i]:
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
- __pyx_r = ((PyObject *)__pyx_kp_s_28);
+ __Pyx_INCREF(__pyx_kp_s_node_shape_circle);
+ __pyx_r = __pyx_kp_s_node_shape_circle;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15432,7 +17220,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":67
+ /* "cdec/lattice.pxi":67
* yield 'rankdir = LR;'
* yield 'node [shape=circle];'
* for i in range(len(self)): # <<<<<<<<<<<<<<
@@ -15451,38 +17239,41 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -15490,49 +17281,52 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":68
+ /* "cdec/lattice.pxi":68
* yield 'node [shape=circle];'
* for i in range(len(self)):
* for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
*/
- __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_7)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_5);
if (unlikely(!__pyx_t_1)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
@@ -15573,8 +17367,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GOTREF(__pyx_t_10);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
@@ -15598,22 +17391,19 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_label);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_label);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_label, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
- __pyx_cur_scope->__pyx_v_label = __pyx_t_8;
__pyx_t_8 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_weight, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
- __pyx_cur_scope->__pyx_v_weight = __pyx_t_9;
__pyx_t_9 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_delta);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_delta);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_delta, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
- __pyx_cur_scope->__pyx_v_delta = __pyx_t_10;
__pyx_t_10 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":69
+ /* "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('"', '\\"')) # <<<<<<<<<<<<<<
@@ -15622,9 +17412,9 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
*/
__pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_delta); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s__replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_label, __pyx_n_s_replace); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -15638,10 +17428,10 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_1 = 0;
__pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_9));
- __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
- __pyx_r = ((PyObject *)__pyx_t_9);
+ __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_d_d_label_s, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_9;
__pyx_t_9 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_t_3);
@@ -15668,28 +17458,45 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
__pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_7 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/lattice.pxi":68
+ * yield 'node [shape=circle];'
+ * for i in range(len(self)):
+ * for label, weight, delta in self[i]: # <<<<<<<<<<<<<<
+ * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
+ * yield '%d [shape=doublecircle]' % len(self)
+ */
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "cdec/lattice.pxi":67
+ * yield 'rankdir = LR;'
+ * yield 'node [shape=circle];'
+ * for i in range(len(self)): # <<<<<<<<<<<<<<
+ * for label, weight, delta in self[i]:
+ * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":70
+ /* "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) # <<<<<<<<<<<<<<
* yield '}'
* return '\n'.join(lines()).encode('utf8')
*/
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
__pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d_shape_doublecircle, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = ((PyObject *)__pyx_t_5);
+ __pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -15699,15 +17506,15 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__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;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":71
+ /* "cdec/lattice.pxi":71
* yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"'))
* yield '%d [shape=doublecircle]' % len(self)
* yield '}' # <<<<<<<<<<<<<<
* return '\n'.join(lines()).encode('utf8')
*
*/
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
- __pyx_r = ((PyObject *)__pyx_kp_s_34);
+ __Pyx_INCREF(__pyx_kp_s__13);
+ __pyx_r = __pyx_kp_s__13;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -15715,6 +17522,16 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
return __pyx_r;
__pyx_L15_resume_from_yield:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/lattice.pxi":63
+ * def todot(self):
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines(): # <<<<<<<<<<<<<<
+ * yield 'digraph lattice {'
+ * yield 'rankdir = LR;'
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -15734,7 +17551,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
return NULL;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":61
+/* "cdec/lattice.pxi":61
* yield self[i]
*
* def todot(self): # <<<<<<<<<<<<<<
@@ -15743,18 +17560,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator23(__pyx_Genera
*/
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *__pyx_cur_scope;
PyObject *__pyx_v_lines = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("todot", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_todot(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_todot, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -15764,19 +17580,19 @@ 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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
+ /* "cdec/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_38, ((PyObject*)__pyx_cur_scope), __pyx_n_s_39, ((PyObject *)__pyx_k_codeobj_36)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_todot_locals_lines, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec__cdec, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_lines = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":72
+ /* "cdec/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
@@ -15784,35 +17600,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
* def as_hypergraph(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_v_lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__16, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/lattice.pxi":61
+ * yield self[i]
+ *
+ * def todot(self): # <<<<<<<<<<<<<<
+ * """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
+ * def lines():
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.Lattice.todot", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -15823,6 +17637,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5
return __pyx_r;
}
+/* "cdec/lattice.pxi":74
+ * return '\n'.join(lines()).encode('utf8')
+ *
+ * def as_hypergraph(self): # <<<<<<<<<<<<<<
+ * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph[] = "lattice.as_hypergraph() -> Hypergraph representation of the lattice.";
@@ -15831,18 +17653,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("as_hypergraph (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":74
- * return '\n'.join(lines()).encode('utf8')
- *
- * def as_hypergraph(self): # <<<<<<<<<<<<<<
- * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
- * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_result = 0;
PyObject *__pyx_v_plf = 0;
@@ -15856,20 +17672,20 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("as_hypergraph", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":76
+ /* "cdec/lattice.pxi":76
* def as_hypergraph(self):
* """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph) # <<<<<<<<<<<<<<
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self)
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_Hypergraph)))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":77
+ /* "cdec/lattice.pxi":77
* """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<<
@@ -15878,7 +17694,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
*/
__pyx_v_result->hg = new Hypergraph();
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":78
+ /* "cdec/lattice.pxi":78
* cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self) # <<<<<<<<<<<<<<
@@ -15890,23 +17706,23 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_plf = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":79
+ /* "cdec/lattice.pxi":79
* result.hg = new hypergraph.Hypergraph()
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<<
* return result
*/
- __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;}
+ __pyx_t_3 = __pyx_convert_string_from_py_(__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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":80
+ /* "cdec/lattice.pxi":80
* cdef bytes plf = str(self)
* hypergraph.ReadFromPLF(plf, result.hg)
* return result # <<<<<<<<<<<<<<
@@ -15916,8 +17732,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/lattice.pxi":74
+ * return '\n'.join(lines()).encode('utf8')
+ *
+ * def as_hypergraph(self): # <<<<<<<<<<<<<<
+ * """lattice.as_hypergraph() -> Hypergraph representation of the lattice."""
+ * cdef Hypergraph result = Hypergraph.__new__(Hypergraph)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -15931,7 +17754,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":3
+/* "cdec/mteval.pxi":3
* cimport mteval
*
* cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
@@ -15953,7 +17776,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":4
+ /* "cdec/mteval.pxi":4
*
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats): # <<<<<<<<<<<<<<
@@ -15964,7 +17787,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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":5
+ /* "cdec/mteval.pxi":5
* cdef SufficientStats as_stats(x, y):
* if isinstance(x, SufficientStats):
* return x # <<<<<<<<<<<<<<
@@ -15976,10 +17799,9 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__Pyx_INCREF(__pyx_v_x);
__pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_x);
goto __pyx_L0;
- goto __pyx_L3;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":6
+ /* "cdec/mteval.pxi":6
* if isinstance(x, SufficientStats):
* return x
* elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<<
@@ -15987,29 +17809,34 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
* stats.stats = new mteval.SufficientStats()
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_2) {
- __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats));
- __pyx_t_4 = __pyx_t_1;
+ if (__pyx_t_1) {
+ goto __pyx_L5_next_and;
} else {
- __pyx_t_4 = __pyx_t_2;
- }
- if (__pyx_t_4) {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_L5_next_and:;
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats));
+ __pyx_t_4 = (__pyx_t_1 != 0);
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":7
+ /* "cdec/mteval.pxi":7
* return x
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats() # <<<<<<<<<<<<<<
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_stats = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":8
+ /* "cdec/mteval.pxi":8
* elif x == 0 and isinstance(y, SufficientStats):
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -16018,7 +17845,7 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
*/
__pyx_v_stats->stats = new SufficientStats();
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":9
+ /* "cdec/mteval.pxi":9
* stats = SufficientStats()
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric # <<<<<<<<<<<<<<
@@ -16028,7 +17855,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":10
+ /* "cdec/mteval.pxi":10
* stats.stats = new mteval.SufficientStats()
* stats.metric = (<SufficientStats> y).metric
* return stats # <<<<<<<<<<<<<<
@@ -16039,10 +17866,17 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
__Pyx_INCREF(((PyObject *)__pyx_v_stats));
__pyx_r = __pyx_v_stats;
goto __pyx_L0;
- goto __pyx_L3;
}
- __pyx_L3:;
+ /* "cdec/mteval.pxi":3
+ * cimport mteval
+ *
+ * cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<<
+ * if isinstance(x, SufficientStats):
+ * return x
+ */
+
+ /* function exit code */
__pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -16056,6 +17890,14 @@ static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_st
return __pyx_r;
}
+/* "cdec/mteval.pxi":17
+ *
+ * property words:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self) {
@@ -16063,18 +17905,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":17
- *
- * property words:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16086,7 +17922,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":18
+ /* "cdec/mteval.pxi":18
* property words:
* def __get__(self):
* return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<<
@@ -16095,25 +17931,32 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBytes_FromString(TD::GetString(__pyx_v_self->candidate->ewords).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), ((PyObject *)__pyx_n_s__utf8)) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_encoding, __pyx_n_s_utf8) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyUnicode_Type))), __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":17
+ *
+ * property words:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8')
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -16126,6 +17969,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_ob
return __pyx_r;
}
+/* "cdec/mteval.pxi":21
+ *
+ * property fmap:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self) {
@@ -16133,18 +17984,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":21
- *
- * property fmap:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
- * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_fmap = 0;
PyObject *__pyx_r = NULL;
@@ -16155,29 +18000,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":22
+ /* "cdec/mteval.pxi":22
* property fmap:
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<<
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap
*/
- __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_tp_new_4cdec_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":23
+ /* "cdec/mteval.pxi":23
* def __get__(self):
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<<
* return fmap
*
*/
- __pyx_v_fmap->vector = new FastSparseVector<weight_t>(__pyx_v_self->candidate->fmap);
+ __pyx_v_fmap->vector = new FastSparseVector<weight_t> (__pyx_v_self->candidate->fmap);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":24
+ /* "cdec/mteval.pxi":24
* cdef SparseVector fmap = SparseVector.__new__(SparseVector)
* fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
* return fmap # <<<<<<<<<<<<<<
@@ -16189,8 +18034,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
__pyx_r = ((PyObject *)__pyx_v_fmap);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":21
+ *
+ * property fmap:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef SparseVector fmap = SparseVector.__new__(SparseVector)
+ * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Candidate.fmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16202,6 +18054,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj
return __pyx_r;
}
+/* "cdec/mteval.pxi":14
+ * cdef class Candidate:
+ * cdef mteval.const_Candidate* candidate
+ * cdef public float score # <<<<<<<<<<<<<<
+ *
+ * property words:
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self) {
@@ -16209,18 +18069,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":14
- * cdef class Candidate:
- * cdef mteval.const_Candidate* candidate
- * cdef public float score # <<<<<<<<<<<<<<
- *
- * property words:
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16236,8 +18090,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(struct __pyx_ob
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Candidate.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16255,6 +18108,8 @@ static int __pyx_pw_4cdec_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -16270,6 +18125,7 @@ static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cd
__pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->score = __pyx_t_1;
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -16280,28 +18136,82 @@ static int __pyx_pf_4cdec_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/mteval.pxi":30
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.stats = new mteval.SufficientStats()
+ *
+ */
+
/* Python wrapper */
-static void __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self) {
+static int __pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_r;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
- __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
+ if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
+ return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":30
+static int __pyx_pf_4cdec_5_cdec_15SufficientStats___cinit__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+
+ /* "cdec/mteval.pxi":31
+ *
+ * def __cinit__(self):
+ * self.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(self):
+ */
+ __pyx_v_self->stats = new SufficientStats();
+
+ /* "cdec/mteval.pxi":30
* cdef mteval.EvaluationMetric* metric
*
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.stats = new mteval.SufficientStats()
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "cdec/mteval.pxi":33
+ * self.stats = new mteval.SufficientStats()
+ *
* def __dealloc__(self): # <<<<<<<<<<<<<<
* del self.stats
*
*/
-static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+/* Python wrapper */
+static void __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(PyObject *__pyx_v_self) {
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_pf_4cdec_5_cdec_15SufficientStats_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":31
+ /* "cdec/mteval.pxi":34
*
* def __dealloc__(self):
* del self.stats # <<<<<<<<<<<<<<
@@ -16310,9 +18220,26 @@ static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED st
*/
delete __pyx_v_self->stats;
+ /* "cdec/mteval.pxi":33
+ * self.stats = new mteval.SufficientStats()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.stats
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/mteval.pxi":37
+ *
+ * property score:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.metric.ComputeScore(self.stats[0])
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self) {
@@ -16320,18 +18247,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":34
- *
- * property score:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.metric.ComputeScore(self.stats[0])
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16341,7 +18262,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":35
+ /* "cdec/mteval.pxi":38
* property score:
* def __get__(self):
* return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<<
@@ -16349,14 +18270,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
* property detail:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->metric->ComputeScore((__pyx_v_self->stats[0]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 38; __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;
+ /* "cdec/mteval.pxi":37
+ *
+ * property score:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.metric.ComputeScore(self.stats[0])
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16367,6 +18295,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(struct _
return __pyx_r;
}
+/* "cdec/mteval.pxi":41
+ *
+ * property detail:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self) {
@@ -16374,18 +18310,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(PyObje
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":38
- *
- * property detail:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return str(self.metric.DetailedScore(self.stats[0]).c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -16396,7 +18326,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":39
+ /* "cdec/mteval.pxi":42
* property detail:
* def __get__(self):
* return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<<
@@ -16404,22 +18334,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->metric->DetailedScore((__pyx_v_self->stats[0])).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":41
+ *
+ * property detail:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -16431,31 +18368,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(struct
return __pyx_r;
}
+/* "cdec/mteval.pxi":44
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.stats.size()
+ *
+ */
+
/* Python wrapper */
-static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":41
- * return str(self.metric.DetailedScore(self.stats[0]).c_str())
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.stats.size()
- *
- */
-
-static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_4__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":42
+ /* "cdec/mteval.pxi":45
*
* def __len__(self):
* return self.stats.size() # <<<<<<<<<<<<<<
@@ -16465,41 +18404,51 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_
__pyx_r = __pyx_v_self->stats->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/mteval.pxi":44
+ * return str(self.metric.DetailedScore(self.stats[0]).c_str())
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.stats.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_8generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/mteval.pxi":47
+ * return self.stats.size()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
+ */
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":44
- * return self.stats.size()
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * for i in range(len(self)):
- * yield self[i]
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_cur_scope;
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_6__iter__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -16509,32 +18458,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_15SufficientStats_8generator19, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SufficientStats___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_8generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- PyObject *(*__pyx_t_4)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -16548,82 +18494,32 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":45
+ /* "cdec/mteval.pxi":48
*
* def __iter__(self):
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
- __pyx_t_4 = NULL;
- } else {
- __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_3);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- break;
- }
- __Pyx_GOTREF(__pyx_t_2);
- }
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i);
- __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- __pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":46
+ /* "cdec/mteval.pxi":49
* def __iter__(self):
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def __getitem__(self, int index):
*/
- __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __Pyx_XGIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -16631,17 +18527,22 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return __pyx_r;
__pyx_L6_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
- __Pyx_XGOTREF(__pyx_t_3);
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "cdec/mteval.pxi":47
+ * return self.stats.size()
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * for i in range(len(self)):
+ * yield self[i]
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
@@ -16652,9 +18553,17 @@ static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator18(__pyx_Gene
return NULL;
}
+/* "cdec/mteval.pxi":51
+ * yield self[i]
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('sufficient stats vector index out of range')
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
int __pyx_v_index;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -16663,7 +18572,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_index); {
- __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_index = __Pyx_PyInt_As_int(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -16671,20 +18580,14 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__(PyObject *
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((int)__pyx_v_index));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((int)__pyx_v_index));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":48
- * yield self[i]
- *
- * def __getitem__(self, int index): # <<<<<<<<<<<<<<
- * if not 0 <= index < len(self):
- * raise IndexError('sufficient stats vector index out of range')
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__getitem__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
@@ -16696,7 +18599,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":49
+ /* "cdec/mteval.pxi":52
*
* def __getitem__(self, int index):
* if not 0 <= index < len(self): # <<<<<<<<<<<<<<
@@ -16705,29 +18608,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
*/
__pyx_t_1 = (0 <= __pyx_v_index);
if (__pyx_t_1) {
- __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_v_index < __pyx_t_2);
}
__pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":50
+ /* "cdec/mteval.pxi":53
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
* return self.stats[0][index]
*
*/
- __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":51
+ /* "cdec/mteval.pxi":54
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range')
* return self.stats[0][index] # <<<<<<<<<<<<<<
@@ -16735,14 +18636,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
* def __iadd__(SufficientStats self, SufficientStats other):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_self->stats[0])[__pyx_v_index])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_self->stats[0])[__pyx_v_index])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":51
+ * yield self[i]
+ *
+ * def __getitem__(self, int index): # <<<<<<<<<<<<<<
+ * if not 0 <= index < len(self):
+ * raise IndexError('sufficient stats vector index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16753,17 +18661,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__getitem__(struct __p
return __pyx_r;
}
+/* "cdec/mteval.pxi":56
+ * return self.stats[0][index]
+ *
+ * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
+ * self.stats[0] += other.stats[0]
+ * return self
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
CYTHON_UNUSED int __pyx_lineno = 0;
CYTHON_UNUSED const char *__pyx_filename = NULL;
CYTHON_UNUSED int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_other));
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_5_cdec_SufficientStats, 1, "other", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_other));
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -16772,20 +18690,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__(PyObject *__
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":53
- * return self.stats[0][index]
- *
- * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
- * self.stats[0] += other.stats[0]
- * return self
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__iadd__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_other) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iadd__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":54
+ /* "cdec/mteval.pxi":57
*
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0] # <<<<<<<<<<<<<<
@@ -16794,7 +18704,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_
*/
(__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":55
+ /* "cdec/mteval.pxi":58
* def __iadd__(SufficientStats self, SufficientStats other):
* self.stats[0] += other.stats[0]
* return self # <<<<<<<<<<<<<<
@@ -16806,33 +18716,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_9__iadd__(struct __pyx_
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/mteval.pxi":56
+ * return self.stats[0][index]
+ *
+ * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<<
+ * self.stats[0] += other.stats[0]
+ * return self
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/mteval.pxi":60
+ * return self
+ *
+ * def __add__(x, y): # <<<<<<<<<<<<<<
+ * cdef SufficientStats sx = as_stats(x, y)
+ * cdef SufficientStats sy = as_stats(y, x)
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
-static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+ __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":57
- * return self
- *
- * def __add__(x, y): # <<<<<<<<<<<<<<
- * cdef SufficientStats sx = as_stats(x, y)
- * cdef SufficientStats sy = as_stats(y, x)
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_13__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sx = 0;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sy = 0;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_result = 0;
@@ -16845,43 +18765,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__add__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":58
+ /* "cdec/mteval.pxi":61
*
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<<
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sx = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":59
+ /* "cdec/mteval.pxi":62
* def __add__(x, y):
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<<
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
*/
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sy = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":60
+ /* "cdec/mteval.pxi":63
* cdef SufficientStats sx = as_stats(x, y)
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<<
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":61
+ /* "cdec/mteval.pxi":64
* cdef SufficientStats sy = as_stats(y, x)
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<<
@@ -16890,7 +18810,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])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":62
+ /* "cdec/mteval.pxi":65
* cdef SufficientStats result = SufficientStats()
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric # <<<<<<<<<<<<<<
@@ -16900,7 +18820,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":63
+ /* "cdec/mteval.pxi":66
* result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0]))
* result.metric = sx.metric
* return result # <<<<<<<<<<<<<<
@@ -16912,8 +18832,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":60
+ * return self
+ *
+ * def __add__(x, y): # <<<<<<<<<<<<<<
+ * cdef SufficientStats sx = as_stats(x, y)
+ * cdef SufficientStats sy = as_stats(y, x)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.SufficientStats.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -16927,6 +18854,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(PyObject *__p
return __pyx_r;
}
+/* "cdec/mteval.pxi":73
+ * cdef mteval.CandidateSet* cs
+ *
+ * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
+ * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
+ * self.metric = evaluator.metric
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -16938,7 +18873,7 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__evaluator,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_evaluator,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -16951,11 +18886,11 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__evaluator)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_evaluator)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -16966,14 +18901,16 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_4cdec_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_evaluator), __pyx_ptype_4cdec_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_evaluator);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -16982,30 +18919,22 @@ static int __pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_sel
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":70
- * cdef mteval.CandidateSet* cs
- *
- * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
- * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
- * self.metric = evaluator.metric
- */
-
static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator) {
int __pyx_r;
__Pyx_RefNannyDeclarations
EvaluationMetric *__pyx_t_1;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":71
+ /* "cdec/mteval.pxi":74
*
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<<
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet()
*/
- __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator>((__pyx_v_evaluator->scorer[0]));
+ __pyx_v_self->scorer = new boost::shared_ptr<SegmentEvaluator> ((__pyx_v_evaluator->scorer[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":72
+ /* "cdec/mteval.pxi":75
* def __cinit__(self, SegmentEvaluator evaluator):
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric # <<<<<<<<<<<<<<
@@ -17015,7 +18944,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":73
+ /* "cdec/mteval.pxi":76
* self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
* self.metric = evaluator.metric
* self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<<
@@ -17024,33 +18953,44 @@ static int __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_4cdec
*/
__pyx_v_self->cs = new training::CandidateSet();
+ /* "cdec/mteval.pxi":73
+ * cdef mteval.CandidateSet* cs
+ *
+ * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<<
+ * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0])
+ * self.metric = evaluator.metric
+ */
+
+ /* function exit code */
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/mteval.pxi":78
+ * self.cs = new mteval.CandidateSet()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ * del self.cs
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":75
- * self.cs = new mteval.CandidateSet()
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.scorer
- * del self.cs
- */
-
-static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":76
+ /* "cdec/mteval.pxi":79
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -17059,7 +18999,7 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->scorer;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":77
+ /* "cdec/mteval.pxi":80
* def __dealloc__(self):
* del self.scorer
* del self.cs # <<<<<<<<<<<<<<
@@ -17068,9 +19008,26 @@ static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED stru
*/
delete __pyx_v_self->cs;
+ /* "cdec/mteval.pxi":78
+ * self.cs = new mteval.CandidateSet()
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ * del self.cs
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/mteval.pxi":82
+ * del self.cs
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.cs.size()
+ *
+ */
+
/* Python wrapper */
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self) {
@@ -17078,24 +19035,18 @@ static Py_ssize_t __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":79
- * del self.cs
- *
- * def __len__(self): # <<<<<<<<<<<<<<
- * return self.cs.size()
- *
- */
-
static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":80
+ /* "cdec/mteval.pxi":83
*
* def __len__(self):
* return self.cs.size() # <<<<<<<<<<<<<<
@@ -17105,12 +19056,28 @@ static Py_ssize_t __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(struct __pyx_obj
__pyx_r = __pyx_v_self->cs->size();
goto __pyx_L0;
- __pyx_r = 0;
+ /* "cdec/mteval.pxi":82
+ * del self.cs
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self.cs.size()
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/mteval.pxi":85
+ * return self.cs.size()
+ *
+ * def __getitem__(self,int k): # <<<<<<<<<<<<<<
+ * if not 0 <= k < self.cs.size():
+ * raise IndexError('candidate set index out of range')
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) {
@@ -17122,7 +19089,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
assert(__pyx_arg_k); {
- __pyx_v_k = __Pyx_PyInt_AsInt(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_As_int(__pyx_arg_k); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -17131,18 +19098,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__(PyObject *__p
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), ((int)__pyx_v_k));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":82
- * return self.cs.size()
- *
- * def __getitem__(self,int k): # <<<<<<<<<<<<<<
- * if not 0 <= k < self.cs.size():
- * raise IndexError('candidate set index out of range')
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k) {
struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_candidate = 0;
PyObject *__pyx_r = NULL;
@@ -17155,7 +19116,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":83
+ /* "cdec/mteval.pxi":86
*
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<<
@@ -17169,35 +19130,33 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":84
+ /* "cdec/mteval.pxi":87
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":85
+ /* "cdec/mteval.pxi":88
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<<
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Candidate)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Candidate)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_candidate = ((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":86
+ /* "cdec/mteval.pxi":89
* raise IndexError('candidate set index out of range')
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<<
@@ -17206,7 +19165,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]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":87
+ /* "cdec/mteval.pxi":90
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<<
@@ -17215,7 +19174,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":88
+ /* "cdec/mteval.pxi":91
* candidate.candidate = &self.cs[0][k]
* candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats)
* return candidate # <<<<<<<<<<<<<<
@@ -17227,8 +19186,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
__pyx_r = ((PyObject *)__pyx_v_candidate);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":85
+ * return self.cs.size()
+ *
+ * def __getitem__(self,int k): # <<<<<<<<<<<<<<
+ * if not 0 <= k < self.cs.size():
+ * raise IndexError('candidate set index out of range')
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -17239,7 +19205,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(struct __pyx_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/mteval.pxi":93
+ * return candidate
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self); /*proto*/
@@ -17248,27 +19222,21 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":90
- * return candidate
- *
- * def __iter__(self): # <<<<<<<<<<<<<<
- * cdef unsigned i
- * for i in range(len(self)):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -17278,27 +19246,25 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj
__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_12CandidateSet_10generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_12CandidateSet_10generator20, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_CandidateSet___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
Py_ssize_t __pyx_t_1;
unsigned int __pyx_t_2;
@@ -17316,27 +19282,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":92
+ /* "cdec/mteval.pxi":95
* def __iter__(self):
* cdef unsigned i
* for i in range(len(self)): # <<<<<<<<<<<<<<
* yield self[i]
*
*/
- __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":93
+ /* "cdec/mteval.pxi":96
* cdef unsigned i
* for i in range(len(self)):
* yield self[i] # <<<<<<<<<<<<<<
*
* def add_kbest(self, Hypergraph hypergraph, unsigned k):
*/
- __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -17350,8 +19316,18 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
__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[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+
+ /* "cdec/mteval.pxi":93
+ * return candidate
+ *
+ * def __iter__(self): # <<<<<<<<<<<<<<
+ * cdef unsigned i
+ * for i in range(len(self)):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
@@ -17365,6 +19341,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator19(__pyx_Genera
return NULL;
}
+/* "cdec/mteval.pxi":98
+ * yield self[i]
+ *
+ * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
+ * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
+ * from the hypergraph and add them to the candidate set."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest[] = "cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses \n from the hypergraph and add them to the candidate set.";
@@ -17378,7 +19362,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hypergraph,&__pyx_n_s__k,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hypergraph,&__pyx_n_s_k,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17392,16 +19376,16 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hypergraph)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hypergraph)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_kbest") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -17410,18 +19394,20 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_hypergraph = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)values[0]);
- __pyx_v_k = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_k = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_k == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_kbest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.CandidateSet.add_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_4cdec_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hypergraph), __pyx_ptype_4cdec_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_hypergraph, __pyx_v_k);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
@@ -17430,20 +19416,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__py
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":95
- * yield self[i]
- *
- * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
- * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
- * from the hypergraph and add them to the candidate set."""
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("add_kbest", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":98
+ /* "cdec/mteval.pxi":101
* """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()) # <<<<<<<<<<<<<<
@@ -17452,34 +19430,45 @@ static PyObject *__pyx_pf_4cdec_5_cdec_12CandidateSet_11add_kbest(struct __pyx_o
*/
__pyx_v_self->cs->AddKBestCandidates((__pyx_v_hypergraph->hg[0]), __pyx_v_k, __pyx_v_self->scorer->get());
+ /* "cdec/mteval.pxi":98
+ * yield self[i]
+ *
+ * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<<
+ * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses
+ * from the hypergraph and add them to the candidate set."""
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/mteval.pxi":107
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":104
- * cdef mteval.EvaluationMetric* metric
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.scorer
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":105
+ /* "cdec/mteval.pxi":108
*
* def __dealloc__(self):
* del self.scorer # <<<<<<<<<<<<<<
@@ -17488,9 +19477,26 @@ static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED s
*/
delete __pyx_v_self->scorer;
+ /* "cdec/mteval.pxi":107
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.scorer
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/mteval.pxi":110
+ * del self.scorer
+ *
+ * def evaluate(self, sentence): # <<<<<<<<<<<<<<
+ * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
+ * cdef vector[WordID] hyp
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_v_sentence); /*proto*/
static char __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate[] = "se.evaluate(sentence) -> SufficientStats for the given hypothesis.";
@@ -17499,45 +19505,40 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self), ((PyObject *)__pyx_v_sentence));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":107
- * del self.scorer
- *
- * def evaluate(self, sentence): # <<<<<<<<<<<<<<
- * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
- * cdef vector[WordID] hyp
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence) {
- std::vector<WordID> __pyx_v_hyp;
+ std::vector<WordID> __pyx_v_hyp;
struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sf = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
EvaluationMetric *__pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- std::string __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
+ std::string __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":110
+ /* "cdec/mteval.pxi":113
* """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats() # <<<<<<<<<<<<<<
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_sf = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":111
+ /* "cdec/mteval.pxi":114
* cdef vector[WordID] hyp
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric # <<<<<<<<<<<<<<
@@ -17547,7 +19548,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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":112
+ /* "cdec/mteval.pxi":115
* cdef SufficientStats sf = SufficientStats()
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<<
@@ -17556,26 +19557,41 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
*/
__pyx_v_sf->stats = new SufficientStats();
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":113
+ /* "cdec/mteval.pxi":116
* sf.metric = self.metric
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(as_str(sentence.strip()), &hyp) # <<<<<<<<<<<<<<
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s_strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __pyx_convert_string_from_py_(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp));
+ __pyx_t_5 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ TD::ConvertSentence(__pyx_t_5, (&__pyx_v_hyp));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":114
+ /* "cdec/mteval.pxi":117
* sf.stats = new mteval.SufficientStats()
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<<
@@ -17584,7 +19600,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);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":115
+ /* "cdec/mteval.pxi":118
* ConvertSentence(as_str(sentence.strip()), &hyp)
* self.scorer.get().Evaluate(hyp, sf.stats)
* return sf # <<<<<<<<<<<<<<
@@ -17596,11 +19612,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
__pyx_r = ((PyObject *)__pyx_v_sf);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":110
+ * del self.scorer
+ *
+ * def evaluate(self, sentence): # <<<<<<<<<<<<<<
+ * """se.evaluate(sentence) -> SufficientStats for the given hypothesis."""
+ * cdef vector[WordID] hyp
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.SegmentEvaluator.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -17610,6 +19634,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx
return __pyx_r;
}
+/* "cdec/mteval.pxi":120
+ * return sf
+ *
+ * def candidate_set(self): # <<<<<<<<<<<<<<
+ * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
+ * return CandidateSet(self)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set[] = "se.candidate_set() -> Candidate set using this segment evaluator for scoring.";
@@ -17618,18 +19650,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObjec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("candidate_set (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":117
- * return sf
- *
- * def candidate_set(self): # <<<<<<<<<<<<<<
- * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
- * return CandidateSet(self)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -17640,7 +19666,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("candidate_set", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":119
+ /* "cdec/mteval.pxi":122
* def candidate_set(self):
* """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
* return CandidateSet(self) # <<<<<<<<<<<<<<
@@ -17648,20 +19674,27 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
* cdef class Scorer:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_CandidateSet)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_CandidateSet)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":120
+ * return sf
+ *
+ * def candidate_set(self): # <<<<<<<<<<<<<<
+ * """se.candidate_set() -> Candidate set using this segment evaluator for scoring."""
+ * return CandidateSet(self)
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -17673,6 +19706,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(struct
return __pyx_r;
}
+/* "cdec/mteval.pxi":128
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
+ * if name:
+ * self.name = new string(name)
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -17684,16 +19725,8 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
PyObject* values[1] = {0};
-
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":125
- * cdef mteval.EvaluationMetric* metric
- *
- * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
- * if name:
- * self.name = new string(name)
- */
values[0] = ((PyObject*)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17707,12 +19740,12 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name);
if (value) { values[0] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -17725,14 +19758,16 @@ static int __pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyBytes_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_name);
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
@@ -17752,33 +19787,33 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":126
+ /* "cdec/mteval.pxi":129
*
* def __cinit__(self, bytes name=None):
* if name: # <<<<<<<<<<<<<<
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0])
*/
- __pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0);
+ __pyx_t_1 = (__pyx_v_name != Py_None) && (PyBytes_GET_SIZE(__pyx_v_name) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":127
+ /* "cdec/mteval.pxi":130
* def __cinit__(self, bytes name=None):
* if name:
* self.name = new string(name) # <<<<<<<<<<<<<<
* self.metric = mteval.MetricInstance(self.name[0])
*
*/
- __pyx_t_2 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_name)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_3 = new std::string(__pyx_t_2);
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->name = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":128
+ /* "cdec/mteval.pxi":131
* if name:
* self.name = new string(name)
* self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<<
@@ -17790,6 +19825,15 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
}
__pyx_L3:;
+ /* "cdec/mteval.pxi":128
+ * cdef mteval.EvaluationMetric* metric
+ *
+ * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<<
+ * if name:
+ * self.name = new string(name)
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -17800,28 +19844,30 @@ static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "cdec/mteval.pxi":133
+ * self.metric = mteval.MetricInstance(self.name[0])
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.name
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":130
- * self.metric = mteval.MetricInstance(self.name[0])
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.name
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":131
+ /* "cdec/mteval.pxi":134
*
* def __dealloc__(self):
* del self.name # <<<<<<<<<<<<<<
@@ -17830,9 +19876,26 @@ static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __py
*/
delete __pyx_v_self->name;
+ /* "cdec/mteval.pxi":133
+ * self.metric = mteval.MetricInstance(self.name[0])
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.name
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/mteval.pxi":136
+ * del self.name
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * if isinstance(refs, basestring):
+ * refs = [refs]
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -17844,7 +19907,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -17857,11 +19920,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -17872,28 +19935,22 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_4__call__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":133
- * del self.name
- *
- * def __call__(self, refs): # <<<<<<<<<<<<<<
- * if isinstance(refs, basestring):
- * refs = [refs]
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs) {
- std::vector<std::vector<WordID> > *__pyx_v_refsv;
- std::vector<WordID> *__pyx_v_refv;
+ std::vector<std::vector<WordID> > *__pyx_v_refsv;
+ std::vector<WordID> *__pyx_v_refv;
PyObject *__pyx_v_ref = NULL;
struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0;
PyObject *__pyx_r = NULL;
@@ -17901,21 +19958,22 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- std::vector<std::vector<WordID> > *__pyx_t_4;
+ std::vector<std::vector<WordID> > *__pyx_t_4;
Py_ssize_t __pyx_t_5;
PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
- std::vector<WordID> *__pyx_t_8;
+ std::vector<WordID> *__pyx_t_8;
PyObject *__pyx_t_9 = NULL;
- std::string __pyx_t_10;
- EvaluationMetric *__pyx_t_11;
+ PyObject *__pyx_t_10 = NULL;
+ std::string __pyx_t_11;
+ EvaluationMetric *__pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
__Pyx_INCREF(__pyx_v_refs);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":134
+ /* "cdec/mteval.pxi":137
*
* def __call__(self, refs):
* if isinstance(refs, basestring): # <<<<<<<<<<<<<<
@@ -17926,26 +19984,25 @@ 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) {
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":135
+ /* "cdec/mteval.pxi":138
* def __call__(self, refs):
* if isinstance(refs, basestring):
* refs = [refs] # <<<<<<<<<<<<<<
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
*/
- __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_refs);
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_refs);
__Pyx_GIVEREF(__pyx_v_refs);
- __Pyx_DECREF(__pyx_v_refs);
- __pyx_v_refs = ((PyObject *)__pyx_t_3);
+ __Pyx_DECREF_SET(__pyx_v_refs, __pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":136
+ /* "cdec/mteval.pxi":139
* if isinstance(refs, basestring):
* refs = [refs]
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<<
@@ -17953,59 +20010,61 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* for ref in refs:
*/
try {
- __pyx_t_4 = new std::vector<std::vector<WordID> >();
+ __pyx_t_4 = new std::vector<std::vector<WordID> > ();
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_refsv = __pyx_t_4;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":138
+ /* "cdec/mteval.pxi":141
* cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
* cdef vector[WordID]* refv
* for ref in refs: # <<<<<<<<<<<<<<
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv)
*/
- if (PyList_CheckExact(__pyx_v_refs) || PyTuple_CheckExact(__pyx_v_refs)) {
+ if (likely(PyList_CheckExact(__pyx_v_refs)) || PyTuple_CheckExact(__pyx_v_refs)) {
__pyx_t_3 = __pyx_v_refs; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
} else {
- __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_refs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_7 = __pyx_t_6(__pyx_t_3);
if (unlikely(!__pyx_t_7)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_7);
}
- __Pyx_XDECREF(__pyx_v_ref);
- __pyx_v_ref = __pyx_t_7;
+ __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_7);
__pyx_t_7 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":139
+ /* "cdec/mteval.pxi":142
* cdef vector[WordID]* refv
* for ref in refs:
* refv = new vector[WordID]() # <<<<<<<<<<<<<<
@@ -18013,33 +20072,48 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* refsv.push_back(refv[0])
*/
try {
- __pyx_t_8 = new std::vector<WordID>();
+ __pyx_t_8 = new std::vector<WordID> ();
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_refv = __pyx_t_8;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":140
+ /* "cdec/mteval.pxi":143
* for ref in refs:
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<<
* refsv.push_back(refv[0])
* del refv
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s__strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s_strip); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_9, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_10 = __pyx_convert_string_from_py_(__pyx_t_7); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- TD::ConvertSentence(__pyx_t_10, __pyx_v_refv);
+ __pyx_t_11 = __pyx_convert_string_from_py_(__pyx_t_9); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ TD::ConvertSentence(__pyx_t_11, __pyx_v_refv);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":141
+ /* "cdec/mteval.pxi":144
* refv = new vector[WordID]()
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0]) # <<<<<<<<<<<<<<
@@ -18048,7 +20122,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
*/
__pyx_v_refsv->push_back((__pyx_v_refv[0]));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":142
+ /* "cdec/mteval.pxi":145
* ConvertSentence(as_str(ref.strip()), refv)
* refsv.push_back(refv[0])
* del refv # <<<<<<<<<<<<<<
@@ -18056,41 +20130,49 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
*/
delete __pyx_v_refv;
+
+ /* "cdec/mteval.pxi":141
+ * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]()
+ * cdef vector[WordID]* refv
+ * for ref in refs: # <<<<<<<<<<<<<<
+ * refv = new vector[WordID]()
+ * ConvertSentence(as_str(ref.strip()), refv)
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":144
+ /* "cdec/mteval.pxi":147
* del refv
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator() # <<<<<<<<<<<<<<
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SegmentEvaluator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_SegmentEvaluator)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_evaluator = ((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":145
+ /* "cdec/mteval.pxi":148
* cdef unsigned i
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric # <<<<<<<<<<<<<<
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
*/
- __pyx_t_11 = __pyx_v_self->metric;
- __pyx_v_evaluator->metric = __pyx_t_11;
+ __pyx_t_12 = __pyx_v_self->metric;
+ __pyx_v_evaluator->metric = __pyx_t_12;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":146
+ /* "cdec/mteval.pxi":149
* cdef SegmentEvaluator evaluator = SegmentEvaluator()
* evaluator.metric = self.metric
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<<
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
*/
- __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator>(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
+ __pyx_v_evaluator->scorer = new boost::shared_ptr<SegmentEvaluator> (__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0])));
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":148
+ /* "cdec/mteval.pxi":151
* evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator](
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<<
@@ -18099,7 +20181,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
*/
delete __pyx_v_refsv;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":149
+ /* "cdec/mteval.pxi":152
* self.metric.CreateSegmentEvaluator(refsv[0]))
* del refsv # in theory should not delete but store in SegmentEvaluator
* return evaluator # <<<<<<<<<<<<<<
@@ -18111,12 +20193,20 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
__pyx_r = ((PyObject *)__pyx_v_evaluator);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":136
+ * del self.name
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * if isinstance(refs, basestring):
+ * refs = [refs]
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("cdec._cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -18128,6 +20218,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_4__call__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/mteval.pxi":154
+ * return evaluator
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(self.name.c_str())
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) {
@@ -18135,18 +20233,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_6__str__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":151
- * return evaluator
- *
- * def __str__(self): # <<<<<<<<<<<<<<
- * return str(self.name.c_str())
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18157,7 +20249,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":152
+ /* "cdec/mteval.pxi":155
*
* def __str__(self):
* return str(self.name.c_str()) # <<<<<<<<<<<<<<
@@ -18165,22 +20257,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->name->c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":154
+ * return evaluator
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return str(self.name.c_str())
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -18192,7 +20291,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Scorer_6__str__(struct __pyx_obj_4cdec_5
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":154
+/* "cdec/mteval.pxi":157
* return str(self.name.c_str())
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
@@ -18212,35 +20311,38 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- float __pyx_t_7;
+ PyObject *__pyx_t_7 = NULL;
+ float __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_score", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":155
+ /* "cdec/mteval.pxi":158
*
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
* cdef list ss = []
* cdef unsigned i
*/
- __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_);
+ __pyx_t_1 = ((PyObject *)__pyx_v_metric_);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":156
+ /* "cdec/mteval.pxi":159
* cdef float _compute_score(void* metric_, mteval.SufficientStats* stats):
* cdef Metric metric = <Metric> metric_
* cdef list ss = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(stats.size()):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_ss = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":158
+ /* "cdec/mteval.pxi":161
* cdef list ss = []
* cdef unsigned i
* for i in range(stats.size()): # <<<<<<<<<<<<<<
@@ -18251,49 +20353,73 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":159
+ /* "cdec/mteval.pxi":162
* cdef unsigned i
* for i in range(stats.size()):
* ss.append(stats[0][i]) # <<<<<<<<<<<<<<
* return metric.score(ss)
*
*/
- __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_stats[0])[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_stats[0])[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ss, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_ss, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":160
+ /* "cdec/mteval.pxi":163
* for i in range(stats.size()):
* ss.append(stats[0][i])
* return metric.score(ss) # <<<<<<<<<<<<<<
*
* cdef void _compute_sufficient_stats(void* metric_,
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s__score); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s_score); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_INCREF(((PyObject *)__pyx_v_ss));
- PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_ss));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_ss));
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(__pyx_v_ss);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_ss);
+ __Pyx_GIVEREF(__pyx_v_ss);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_7;
+ __pyx_r = __pyx_t_8;
goto __pyx_L0;
- __pyx_r = 0;
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":157
+ * return str(self.name.c_str())
+ *
+ * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<<
+ * cdef Metric metric = <Metric> metric_
+ * cdef list ss = []
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_WriteUnraisable("cdec._cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_WriteUnraisable("cdec._cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_metric);
@@ -18302,7 +20428,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":162
+/* "cdec/mteval.pxi":165
* return metric.score(ss)
*
* cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
@@ -18310,7 +20436,7 @@ static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, Sufficie
* vector[string]* refs,
*/
-static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector<std::string> *__pyx_v_refs, SufficientStats *__pyx_v_out) {
+static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector<std::string> *__pyx_v_refs, SufficientStats *__pyx_v_out) {
struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_metric = 0;
PyObject *__pyx_v_refs_ = 0;
unsigned int __pyx_v_i;
@@ -18322,36 +20448,40 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
- Py_ssize_t __pyx_t_7;
- float __pyx_t_8;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
+ float __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_compute_sufficient_stats", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":166
+ /* "cdec/mteval.pxi":169
* vector[string]* refs,
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_ # <<<<<<<<<<<<<<
* cdef list refs_ = []
* cdef unsigned i
*/
- __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_);
+ __pyx_t_1 = ((PyObject *)__pyx_v_metric_);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":167
+ /* "cdec/mteval.pxi":170
* mteval.SufficientStats* out):
* cdef Metric metric = <Metric> metric_
* cdef list refs_ = [] # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(refs.size()):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_refs_ = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":169
+ /* "cdec/mteval.pxi":172
* cdef list refs_ = []
* cdef unsigned i
* for i in range(refs.size()): # <<<<<<<<<<<<<<
@@ -18362,115 +20492,141 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":170
+ /* "cdec/mteval.pxi":173
* cdef unsigned i
* for i in range(refs.size()):
* refs_.append(str(refs[0][i].c_str())) # <<<<<<<<<<<<<<
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss))
*/
- __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_refs[0])[__pyx_v_i]).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_refs[0])[__pyx_v_i]).c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_refs_, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_refs_, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":171
+ /* "cdec/mteval.pxi":174
* for i in range(refs.size()):
* refs_.append(str(refs[0][i].c_str()))
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) # <<<<<<<<<<<<<<
* out.fields.resize(len(ss))
* for i in range(len(ss)):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s__evaluate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_hyp->c_str()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_metric), __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_hyp->c_str()); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(((PyObject *)__pyx_v_refs_));
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_refs_));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_refs_));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_ss = ((PyObject*)__pyx_t_4);
- __pyx_t_4 = 0;
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_refs_);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_refs_);
+ __Pyx_GIVEREF(__pyx_v_refs_);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_ss = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":172
+ /* "cdec/mteval.pxi":175
* refs_.append(str(refs[0][i].c_str()))
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss)) # <<<<<<<<<<<<<<
* for i in range(len(ss)):
* out.fields[i] = ss[i]
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __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);
+ __pyx_t_8 = PyList_GET_SIZE(__pyx_v_ss); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_out->fields.resize(__pyx_t_8);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":173
+ /* "cdec/mteval.pxi":176
* cdef list ss = metric.evaluate(str(hyp.c_str()), refs_)
* out.fields.resize(len(ss))
* for i in range(len(ss)): # <<<<<<<<<<<<<<
* out.fields[i] = ss[i]
*
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_7 = PyList_GET_SIZE(((PyObject *)__pyx_v_ss)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) {
+ __pyx_t_8 = PyList_GET_SIZE(__pyx_v_ss); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_8; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":174
+ /* "cdec/mteval.pxi":177
* out.fields.resize(len(ss))
* for i in range(len(ss)):
* out.fields[i] = ss[i] # <<<<<<<<<<<<<<
*
* cdef class Metric:
*/
- if (unlikely(((PyObject *)__pyx_v_ss) == Py_None)) {
+ if (unlikely(__pyx_v_ss == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_ss), __pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 1, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- (__pyx_v_out->fields[__pyx_v_i]) = __pyx_t_8;
+ __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_ss, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ (__pyx_v_out->fields[__pyx_v_i]) = __pyx_t_10;
}
+ /* "cdec/mteval.pxi":165
+ * return metric.score(ss)
+ *
+ * cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<<
+ * string* hyp,
+ * vector[string]* refs,
+ */
+
+ /* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_WriteUnraisable("cdec._cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_WriteUnraisable("cdec._cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_metric);
__Pyx_XDECREF(__pyx_v_refs_);
@@ -18478,6 +20634,14 @@ static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_
__Pyx_RefNannyFinishContext();
}
+/* "cdec/mteval.pxi":181
+ * cdef class Metric:
+ * cdef Scorer scorer
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.scorer = Scorer()
+ * cdef bytes class_name = self.__class__.__name__
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18488,18 +20652,12 @@ static int __pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyOb
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric___cinit__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":178
- * cdef class Metric:
- * cdef Scorer scorer
- * def __cinit__(self): # <<<<<<<<<<<<<<
- * self.scorer = Scorer()
- * cdef bytes class_name = self.__class__.__name__
- */
-
static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self) {
PyObject *__pyx_v_class_name = 0;
int __pyx_r;
@@ -18513,14 +20671,14 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":179
+ /* "cdec/mteval.pxi":182
* cdef Scorer scorer
* def __cinit__(self):
* self.scorer = Scorer() # <<<<<<<<<<<<<<
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name)
*/
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->scorer);
@@ -18528,39 +20686,39 @@ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":180
+ /* "cdec/mteval.pxi":183
* def __cinit__(self):
* self.scorer = Scorer()
* cdef bytes class_name = self.__class__.__name__ # <<<<<<<<<<<<<<
* self.scorer.name = new string(class_name)
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0],
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_class_name = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":181
+ /* "cdec/mteval.pxi":184
* self.scorer = Scorer()
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name) # <<<<<<<<<<<<<<
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0],
* <void*> self, _compute_sufficient_stats, _compute_score)
*/
- __pyx_t_3 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_class_name)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_class_name); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
try {
__pyx_t_4 = new std::string(__pyx_t_3);
} catch(...) {
__Pyx_CppExn2PyErr();
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_self->scorer->name = __pyx_t_4;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":182
+ /* "cdec/mteval.pxi":185
* cdef bytes class_name = self.__class__.__name__
* self.scorer.name = new string(class_name)
* self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<<
@@ -18569,6 +20727,15 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
*/
__pyx_v_self->scorer->metric = PythonEvaluationMetric::Instance((__pyx_v_self->scorer->name[0]), ((void *)__pyx_v_self), __pyx_f_4cdec_5_cdec__compute_sufficient_stats, __pyx_f_4cdec_5_cdec__compute_score);
+ /* "cdec/mteval.pxi":181
+ * cdef class Metric:
+ * cdef Scorer scorer
+ * def __cinit__(self): # <<<<<<<<<<<<<<
+ * self.scorer = Scorer()
+ * cdef bytes class_name = self.__class__.__name__
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
@@ -18582,6 +20749,14 @@ static int __pyx_pf_4cdec_5_cdec_6Metric___cinit__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "cdec/mteval.pxi":188
+ * <void*> self, _compute_sufficient_stats, _compute_score)
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * return self.scorer(refs)
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18593,7 +20768,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refs,0};
PyObject* values[1] = {0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -18606,11 +20781,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
@@ -18621,36 +20796,32 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_2__call__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self), __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":185
- * <void*> self, _compute_sufficient_stats, _compute_score)
- *
- * def __call__(self, refs): # <<<<<<<<<<<<<<
- * return self.scorer(refs)
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_refs) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__call__", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":186
+ /* "cdec/mteval.pxi":189
*
* def __call__(self, refs):
* return self.scorer(refs) # <<<<<<<<<<<<<<
@@ -18658,23 +20829,50 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_
* def score(SufficientStats stats):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_refs);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_refs);
- __Pyx_GIVEREF(__pyx_v_refs);
- __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_self->scorer), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->scorer));
+ __pyx_t_2 = ((PyObject *)__pyx_v_self->scorer); __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_refs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_refs);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_refs);
+ __Pyx_GIVEREF(__pyx_v_refs);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/mteval.pxi":188
+ * <void*> self, _compute_sufficient_stats, _compute_score)
+ *
+ * def __call__(self, refs): # <<<<<<<<<<<<<<
+ * return self.scorer(refs)
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec._cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -18683,6 +20881,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_
return __pyx_r;
}
+/* "cdec/mteval.pxi":191
+ * return self.scorer(refs)
+ *
+ * def score(SufficientStats stats): # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused) {
@@ -18690,24 +20896,18 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, C
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_4score(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_stats));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":188
- * return self.scorer(refs)
- *
- * def score(SufficientStats stats): # <<<<<<<<<<<<<<
- * return 0
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_stats) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("score", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":189
+ /* "cdec/mteval.pxi":192
*
* def score(SufficientStats stats):
* return 0 # <<<<<<<<<<<<<<
@@ -18719,13 +20919,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx
__pyx_r = __pyx_int_0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/mteval.pxi":191
+ * return self.scorer(refs)
+ *
+ * def score(SufficientStats stats): # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/mteval.pxi":194
+ * return 0
+ *
+ * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -18738,7 +20954,7 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__hyp,&__pyx_n_s__refs,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hyp,&__pyx_n_s_refs,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -18752,16 +20968,16 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hyp)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hyp)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
- if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refs)) != 0)) kw_args--;
+ if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_refs)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -18774,25 +20990,19 @@ static PyObject *__pyx_pw_4cdec_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self,
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec._cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_6evaluate(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self), __pyx_v_hyp, __pyx_v_refs);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":191
- * return 0
- *
- * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
- * return []
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_hyp, CYTHON_UNUSED PyObject *__pyx_v_refs) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18802,7 +21012,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("evaluate", 0);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":192
+ /* "cdec/mteval.pxi":195
*
* def evaluate(self, hyp, refs):
* return [] # <<<<<<<<<<<<<<
@@ -18810,14 +21020,21 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
* BLEU = Scorer('IBM_BLEU')
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_r = ((PyObject *)__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;
+ /* "cdec/mteval.pxi":194
+ * return 0
+ *
+ * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<<
+ * return []
+ *
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("cdec._cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -18828,27 +21045,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __
return __pyx_r;
}
+/* "cdec/_cdec.pyx":28
+ * class ParseFailed(Exception): pass
+ *
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * """set_silent(bool): Configure the verbosity of cdec."""
+ * SetSilent(yn)
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn); /*proto*/
static char __pyx_doc_4cdec_5_cdec_2set_silent[] = "set_silent(bool): Configure the verbosity of cdec.";
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_3set_silent = {__Pyx_NAMESTR("set_silent"), (PyCFunction)__pyx_pw_4cdec_5_cdec_3set_silent, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_2set_silent)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_3set_silent = {"set_silent", (PyCFunction)__pyx_pw_4cdec_5_cdec_3set_silent, METH_O, __pyx_doc_4cdec_5_cdec_2set_silent};
static PyObject *__pyx_pw_4cdec_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_silent (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_2set_silent(__pyx_self, ((PyObject *)__pyx_v_yn));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":28
- * class ParseFailed(Exception): pass
- *
- * def set_silent(yn): # <<<<<<<<<<<<<<
- * """set_silent(bool): Configure the verbosity of cdec."""
- * SetSilent(yn)
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -18868,6 +21087,15 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_yn); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
SetSilent(__pyx_t_1);
+ /* "cdec/_cdec.pyx":28
+ * class ParseFailed(Exception): pass
+ *
+ * def set_silent(yn): # <<<<<<<<<<<<<<
+ * """set_silent(bool): Configure the verbosity of cdec."""
+ * SetSilent(yn)
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
@@ -18878,37 +21106,39 @@ static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_6generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_5_cdec_5_make_config = {__Pyx_NAMESTR("_make_config"), (PyCFunction)__pyx_pw_4cdec_5_cdec_5_make_config, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_5_cdec_5_make_config = {"_make_config", (PyCFunction)__pyx_pw_4cdec_5_cdec_5_make_config, METH_O, 0};
static PyObject *__pyx_pw_4cdec_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_make_config (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_4_make_config(__pyx_self, ((PyObject *)__pyx_v_config));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":32
- * SetSilent(yn)
- *
- * def _make_config(config): # <<<<<<<<<<<<<<
- * for key, value in config.items():
- * if isinstance(value, dict):
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_make_config", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27__make_config(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27__make_config, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -18918,33 +21148,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__p
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_config);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_6generator20, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_6generator21, (PyObject *) __pyx_cur_scope, __pyx_n_s_make_config, __pyx_n_s_make_config); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec._make_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_6generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
- PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
@@ -18977,48 +21205,66 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* if isinstance(value, dict):
* for name, info in value.items():
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_config, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ } else {
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
- PyObject* sequence = __pyx_t_2;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -19031,30 +21277,29 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
+ index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19069,14 +21314,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_key);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_cur_scope->__pyx_v_key = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_value);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_value = __pyx_t_6;
__pyx_t_6 = 0;
/* "cdec/_cdec.pyx":34
@@ -19097,48 +21340,66 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* yield key, '%s %s' % (name, info)
* elif isinstance(value, list):
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_value, __pyx_n_s_items); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
- __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
- __pyx_t_12 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
+ __pyx_t_12 = NULL;
+ } else {
+ __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_6))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_6 = __pyx_t_12(__pyx_t_2);
- if (unlikely(!__pyx_t_6)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_12(__pyx_t_6);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
- PyObject* sequence = __pyx_t_6;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -19151,30 +21412,29 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_7 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_7);
#else
- __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
#endif
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_13)->tp_iternext;
- index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_5);
+ index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_13); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -19189,14 +21449,12 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_L12_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_cur_scope->__pyx_v_name = __pyx_t_5;
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_info);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_info);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_info, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
- __pyx_cur_scope->__pyx_v_info = __pyx_t_7;
__pyx_t_7 = 0;
/* "cdec/_cdec.pyx":36
@@ -19206,33 +21464,33 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* elif isinstance(value, list):
* for name in value:
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_info);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_info);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_info);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_info);
- __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_7));
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_s_s_2, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_t_7));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
__pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
__pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
@@ -19241,19 +21499,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L13_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
__Pyx_XGOTREF(__pyx_t_2);
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = 0;
+ __Pyx_XGOTREF(__pyx_t_6);
__pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/_cdec.pyx":35
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ * for name, info in value.items(): # <<<<<<<<<<<<<<
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list):
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L8;
}
@@ -19275,45 +21541,47 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* yield key, name
* else:
*/
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_value) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_value)) {
- __pyx_t_2 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_value)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_value)) {
+ __pyx_t_6 = __pyx_cur_scope->__pyx_v_value; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
} else {
- __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_value); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_6))) {
+ if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_6 = __pyx_t_12(__pyx_t_2);
- if (unlikely(!__pyx_t_6)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_12(__pyx_t_6);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_name);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_name = __pyx_t_6;
- __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
/* "cdec/_cdec.pyx":39
* elif isinstance(value, list):
@@ -19322,22 +21590,22 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
* else:
* yield key, str(value)
*/
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
- __pyx_r = ((PyObject *)__pyx_t_6);
- __pyx_t_6 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __Pyx_XGIVEREF(__pyx_t_6);
+ __pyx_cur_scope->__pyx_t_3 = __pyx_t_6;
__pyx_cur_scope->__pyx_t_4 = __pyx_t_11;
__pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
__Pyx_XGIVEREF(__pyx_r);
@@ -19346,19 +21614,27 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
__pyx_generator->resume_label = 2;
return __pyx_r;
__pyx_L16_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = 0;
__Pyx_XGOTREF(__pyx_t_2);
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_3;
+ __pyx_cur_scope->__pyx_t_3 = 0;
+ __Pyx_XGOTREF(__pyx_t_6);
__pyx_t_11 = __pyx_cur_scope->__pyx_t_4;
__pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/_cdec.pyx":38
+ * yield key, '%s %s' % (name, info)
+ * elif isinstance(value, list):
+ * for name in value: # <<<<<<<<<<<<<<
+ * yield key, name
+ * else:
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L8;
}
/*else*/ {
@@ -19370,50 +21646,68 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
*
* cdef class Decoder:
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_value);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_value);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
- __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_key);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_key);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_6;
__pyx_t_6 = 0;
- __pyx_r = ((PyObject *)__pyx_t_2);
- __pyx_t_2 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = __pyx_t_4;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 3;
return __pyx_r;
__pyx_L17_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_3;
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L8:;
+
+ /* "cdec/_cdec.pyx":33
+ *
+ * def _make_config(config):
+ * for key, value in config.items(): # <<<<<<<<<<<<<<
+ * if isinstance(value, dict):
+ * for name, info in value.items():
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "cdec/_cdec.pyx":32
+ * SetSilent(yn)
+ *
+ * def _make_config(config): # <<<<<<<<<<<<<<
+ * for key, value in config.items():
+ * if isinstance(value, dict):
+ */
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_13);
@@ -19426,6 +21720,14 @@ static PyObject *__pyx_gb_4cdec_5_cdec_6generator20(__pyx_GeneratorObject *__pyx
return NULL;
}
+/* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
+ *
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder___init__[] = "Decoder('formalism = scfg') -> initialize from configuration string\n Decoder(formalism='scfg') -> initialize from named parameters\n Create a decoder using a given configuration. Formalism is required.";
@@ -19444,16 +21746,8 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
__pyx_v_config = PyDict_New(); if (unlikely(!__pyx_v_config)) return -1;
__Pyx_GOTREF(__pyx_v_config);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config_str,0};
PyObject* values[1] = {0};
-
- /* "cdec/_cdec.pyx":47
- * cdef DenseVector weights
- *
- * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
- * """Decoder('formalism = scfg') -> initialize from configuration string
- * Decoder(formalism='scfg') -> initialize from named parameters
- */
values[0] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -19467,7 +21761,7 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
switch (pos_args) {
case 0:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__config_str);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_config_str);
if (value) { values[0] = value; kw_args--; }
}
}
@@ -19493,14 +21787,16 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyOb
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder___init__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), __pyx_v_config_str, __pyx_v_config);
+
+ /* function exit code */
__Pyx_XDECREF(__pyx_v_config);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator25(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
* cdef istringstream* config_stream = new istringstream(config_str)
@@ -19508,50 +21804,49 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
*/
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_29_genexpr(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_29_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator25, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_init___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("cdec._cdec.Decoder.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator25(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
- Py_ssize_t __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -19566,66 +21861,84 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
}
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___make_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_make_config); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config));
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
- __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
- __pyx_t_5 = NULL;
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config)) { __Pyx_RaiseClosureNameError("config"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_config);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
+ __pyx_t_6 = NULL;
+ } else {
+ __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_5(__pyx_t_2);
- if (unlikely(!__pyx_t_3)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_1 = __pyx_t_6(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_kv);
- __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_kv);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_kv = __pyx_t_3;
- __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_47), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_r = ((PyObject *)__pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_kv, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_3, __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_XGIVEREF(__pyx_t_2);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
@@ -19635,17 +21948,20 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
__pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_2);
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
- __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -19664,7 +21980,7 @@ static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator24(__pyx_Gen
*/
static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *__pyx_cur_scope;
PyObject *__pyx_v_formalism = NULL;
std::istringstream *__pyx_v_config_stream;
int __pyx_r;
@@ -19673,14 +21989,15 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- char *__pyx_t_7;
+ PyObject *__pyx_t_7 = NULL;
+ char *__pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28___init__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28___init__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return -1;
@@ -19707,9 +22024,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* if config_str is None:
* formalism = config.get('formalism', None) # <<<<<<<<<<<<<<
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
*/
- __pyx_t_3 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_cur_scope->__pyx_v_config), ((PyObject *)__pyx_n_s__formalism), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_cur_scope->__pyx_v_config, __pyx_n_s_formalism, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_formalism = __pyx_t_3;
__pyx_t_3 = 0;
@@ -19718,116 +22035,130 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* if config_str is None:
* formalism = config.get('formalism', None)
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb', # <<<<<<<<<<<<<<
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
*/
__Pyx_INCREF(__pyx_v_formalism);
__pyx_t_3 = __pyx_v_formalism;
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__scfg), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (((int)__pyx_t_2)) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fst), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = ((int)__pyx_t_1);
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_scfg, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L12_next_and;
} else {
- __pyx_t_5 = ((int)__pyx_t_2);
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_5) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lextrans), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = ((int)__pyx_t_2);
+ __pyx_L12_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_fst, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L11_next_and;
} else {
- __pyx_t_1 = __pyx_t_5;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L11_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lextrans, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__pb), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_2 = ((int)__pyx_t_5);
+ goto __pyx_L10_next_and;
} else {
__pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_2) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__csplit), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = ((int)__pyx_t_1);
+ __pyx_L10_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_pb, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L9_next_and;
} else {
- __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_5) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__tagger), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_1 = ((int)__pyx_t_2);
+ __pyx_L9_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_csplit, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L8_next_and;
} else {
- __pyx_t_1 = __pyx_t_5;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L8_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_tagger, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__lexalign), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_2 = ((int)__pyx_t_5);
+ goto __pyx_L7_next_and;
} else {
__pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
}
+ __pyx_L7_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lexalign, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L6_next_and;
+ } else {
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_L6_next_and:;
+ __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_t2s, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L5_bool_binop_done:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* "cdec/_cdec.pyx":55
* if formalism not in ('scfg', 'fst', 'lextrans', 'pb',
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism) # <<<<<<<<<<<<<<
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
* cdef istringstream* config_stream = new istringstream(config_str)
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__InvalidConfig); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), __pyx_v_formalism); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_InvalidConfig); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_formalism_s_unknown, __pyx_v_formalism); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L4;
}
- __pyx_L4:;
/* "cdec/_cdec.pyx":56
- * 'csplit', 'tagger', 'lexalign'):
+ * 'csplit', 'tagger', 'lexalign', 't2s'):
* raise InvalidConfig('formalism "%s" unknown' % formalism)
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config)) # <<<<<<<<<<<<<<
* cdef istringstream* config_stream = new istringstream(config_str)
* self.dec = new decoder.Decoder(config_stream)
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_40), __pyx_n_s__join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_config_str);
- __pyx_v_config_str = __pyx_t_6;
- __pyx_t_6 = 0;
+ __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__16, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_config_str, __pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
__pyx_L3:;
@@ -19839,8 +22170,8 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* self.dec = new decoder.Decoder(config_stream)
* del config_stream
*/
- __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_config_stream = new std::istringstream(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_config_str); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_config_stream = new std::istringstream(__pyx_t_8);
/* "cdec/_cdec.pyx":58
* config_str = '\n'.join('%s = %s' % kv for kv in _make_config(config))
@@ -19867,14 +22198,14 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
* self.weights.vector = &self.dec.CurrentWeightVector()
* self.weights.owned = True
*/
- __pyx_t_6 = __pyx_tp_new_4cdec_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_4cdec_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_4 = __pyx_tp_new_4cdec_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4cdec_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->weights);
__Pyx_DECREF(((PyObject *)__pyx_v_self->weights));
- __pyx_v_self->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_v_self->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_t_4);
+ __pyx_t_4 = 0;
/* "cdec/_cdec.pyx":61
* del config_stream
@@ -19894,12 +22225,23 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
*/
__pyx_v_self->weights->owned = 1;
+ /* "cdec/_cdec.pyx":47
+ * cdef DenseVector weights
+ *
+ * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<<
+ * """Decoder('formalism = scfg') -> initialize from configuration string
+ * Decoder(formalism='scfg') -> initialize from named parameters
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec._cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -19910,24 +22252,26 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder___init__(struct __pyx_obj_4cdec_5_cdec
return __pyx_r;
}
+/* "cdec/_cdec.pyx":64
+ * self.weights.owned = True
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.dec
+ *
+ */
+
/* Python wrapper */
static void __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
-/* "cdec/_cdec.pyx":64
- * self.weights.owned = True
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * del self.dec
- *
- */
-
-static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
+static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
@@ -19940,9 +22284,26 @@ static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __p
*/
delete __pyx_v_self->dec;
+ /* "cdec/_cdec.pyx":64
+ * self.weights.owned = True
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * del self.dec
+ *
+ */
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
}
+/* "cdec/_cdec.pyx":68
+ *
+ * property weights:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.weights
+ *
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self) {
@@ -19950,18 +22311,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(PyObject *__py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":68
- *
- * property weights:
- * def __get__(self): # <<<<<<<<<<<<<<
- * return self.weights
- *
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -19979,13 +22334,29 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(struct __pyx_ob
__pyx_r = ((PyObject *)__pyx_v_self->weights);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ /* "cdec/_cdec.pyx":68
+ *
+ * property weights:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * return self.weights
+ *
+ */
+
+ /* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+/* "cdec/_cdec.pyx":71
+ * return self.weights
+ *
+ * def __set__(self, weights): # <<<<<<<<<<<<<<
+ * if isinstance(weights, DenseVector):
+ * self.weights.vector[0] = (<DenseVector> weights).vector[0]
+ */
+
/* Python wrapper */
static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
@@ -19993,18 +22364,12 @@ static int __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":71
- * return self.weights
- *
- * def __set__(self, weights): # <<<<<<<<<<<<<<
- * if isinstance(weights, DenseVector):
- * self.weights.vector[0] = (<DenseVector> weights).vector[0]
- */
-
static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) {
PyObject *__pyx_v_fname = NULL;
PyObject *__pyx_v_fval = NULL;
@@ -20014,9 +22379,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- Py_ssize_t __pyx_t_5;
- PyObject *(*__pyx_t_6)(PyObject *);
- PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *(*__pyx_t_7)(PyObject *);
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
PyObject *(*__pyx_t_10)(PyObject *);
@@ -20096,48 +22461,66 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
* self.weights[fname] = fval
* else:
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s__items); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_weights, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
- __pyx_t_6 = NULL;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
} else {
- __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
+ __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
+ __pyx_t_7 = NULL;
+ } else {
+ __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
- if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_7)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_6(__pyx_t_3);
- if (unlikely(!__pyx_t_4)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ __pyx_t_3 = __pyx_t_7(__pyx_t_4);
+ if (unlikely(!__pyx_t_3)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_3);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -20150,30 +22533,29 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_7 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_8 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_8);
#else
- __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
#endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- } else
- {
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
Py_ssize_t index = -1;
- __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
- index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_7);
+ index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_8);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -20187,11 +22569,9 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
- __Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_7;
- __pyx_t_7 = 0;
- __Pyx_XDECREF(__pyx_v_fval);
- __pyx_v_fval = __pyx_t_8;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fval, __pyx_t_8);
__pyx_t_8 = 0;
/* "cdec/_cdec.pyx":79
@@ -20201,9 +22581,17 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
* else:
* raise TypeError('cannot initialize weights with %s' % type(weights))
*/
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_v_fname, __pyx_v_fval) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/_cdec.pyx":78
+ * elif isinstance(weights, dict):
+ * self.weights.vector.clear()
+ * for fname, fval in weights.items(): # <<<<<<<<<<<<<<
+ * self.weights[fname] = fval
+ * else:
+ */
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -20215,28 +22603,37 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
*
* property formalism:
*/
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_49), ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_cannot_initialize_weights_with_s, ((PyObject *)Py_TYPE(__pyx_v_weights))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
+ /* "cdec/_cdec.pyx":71
+ * return self.weights
+ *
+ * def __set__(self, weights): # <<<<<<<<<<<<<<
+ * if isinstance(weights, DenseVector):
+ * self.weights.vector[0] = (<DenseVector> weights).vector[0]
+ */
+
+ /* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec._cdec.Decoder.weights.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -20248,6 +22645,14 @@ static int __pyx_pf_4cdec_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_4cd
return __pyx_r;
}
+/* "cdec/_cdec.pyx":84
+ *
+ * property formalism:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * return str(conf[0]['formalism'].as_str().c_str())
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self) {
@@ -20255,18 +22660,12 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(PyObject *__
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self));
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":84
- *
- * property formalism:
- * def __get__(self): # <<<<<<<<<<<<<<
- * cdef variables_map* conf = &self.dec.GetConf()
- * return str(conf[0]['formalism'].as_str().c_str())
- */
-
static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) {
const boost::program_options::variables_map *__pyx_v_conf;
PyObject *__pyx_r = NULL;
@@ -20292,25 +22691,32 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_
* cdef variables_map* conf = &self.dec.GetConf()
* return str(conf[0]['formalism'].as_str().c_str()) # <<<<<<<<<<<<<<
*
- * def read_weights(self, weights):
+ * def read_weights(self, weights, scaling = 1.0):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k__formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __pyx_t_1 = __Pyx_PyBytes_FromString(((__pyx_v_conf[0])[__pyx_k_formalism]).as<std::string>().c_str()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":84
+ *
+ * property formalism:
+ * def __get__(self): # <<<<<<<<<<<<<<
+ * cdef variables_map* conf = &self.dec.GetConf()
+ * return str(conf[0]['formalism'].as_str().c_str())
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
@@ -20322,27 +22728,80 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(struct __pyx_
return __pyx_r;
}
+/* "cdec/_cdec.pyx":88
+ * return str(conf[0]['formalism'].as_str().c_str())
+ *
+ * def read_weights(self, weights, scaling = 1.0): # <<<<<<<<<<<<<<
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ */
+
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/
+static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder_4read_weights[] = "decoder.read_weights(filename): Read decoder weights from a file.";
-static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_weights = 0;
+ PyObject *__pyx_v_scaling = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_weights (wrapper)", 0);
- __pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights));
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_weights,&__pyx_n_s_scaling,0};
+ PyObject* values[2] = {0,0};
+ values[1] = ((PyObject *)__pyx_float_1_0);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_weights)) != 0)) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scaling);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_weights") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_weights = values[0];
+ __pyx_v_scaling = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("read_weights", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("cdec._cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), __pyx_v_weights, __pyx_v_scaling);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "cdec/_cdec.pyx":88
- * return str(conf[0]['formalism'].as_str().c_str())
- *
- * def read_weights(self, weights): # <<<<<<<<<<<<<<
- * """decoder.read_weights(filename): Read decoder weights from a file."""
- * with open(weights) as fp:
- */
-
-static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) {
+static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights, PyObject *__pyx_v_scaling) {
PyObject *__pyx_v_fp = NULL;
PyObject *__pyx_v_line = NULL;
PyObject *__pyx_v_fname = NULL;
@@ -20356,10 +22815,10 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
+ int __pyx_t_11;
PyObject *__pyx_t_12 = NULL;
PyObject *(*__pyx_t_13)(PyObject *);
double __pyx_t_14;
@@ -20371,7 +22830,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
__Pyx_RefNannySetupContext("read_weights", 0);
/* "cdec/_cdec.pyx":90
- * def read_weights(self, weights):
+ * def read_weights(self, weights, scaling = 1.0):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
@@ -20383,27 +22842,43 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
__Pyx_INCREF(__pyx_v_weights);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_weights);
__Pyx_GIVEREF(__pyx_v_weights);
- __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_1;
+ __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_fp = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
/* "cdec/_cdec.pyx":91
* """decoder.read_weights(filename): Read decoder weights from a file."""
@@ -20412,42 +22887,44 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
* if line.strip().startswith('#'): continue
* fname, value = line.split()
*/
- if (PyList_CheckExact(__pyx_v_fp) || PyTuple_CheckExact(__pyx_v_fp)) {
- __pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_fp)) || PyTuple_CheckExact(__pyx_v_fp)) {
+ __pyx_t_4 = __pyx_v_fp; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_4);
+ __pyx_t_2 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_2)) {
- if (PyErr_Occurred()) {
- if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF(__pyx_v_line);
- __pyx_v_line = __pyx_t_2;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
__pyx_t_2 = 0;
/* "cdec/_cdec.pyx":92
@@ -20455,37 +22932,65 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
- * self.weights[fname.strip()] = float(value)
+ * self.weights[fname.strip()] = float(value) * scaling
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_10) {
- goto __pyx_L16_continue;
- goto __pyx_L18;
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_11) {
+ goto __pyx_L15_continue;
}
- __pyx_L18:;
/* "cdec/_cdec.pyx":93
* for line in fp:
* if line.strip().startswith('#'): continue
* fname, value = line.split() # <<<<<<<<<<<<<<
- * self.weights[fname.strip()] = float(value)
+ * self.weights[fname.strip()] = float(value) * scaling
*
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
@@ -20503,84 +23008,107 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_5);
#else
__pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- } else
- {
+ } else {
Py_ssize_t index = -1;
__pyx_t_12 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
- index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed;
+ index = 0; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
- index = 1; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L19_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
+ index = 1; __pyx_t_5 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L18_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_13 = NULL;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- goto __pyx_L20_unpacking_done;
- __pyx_L19_unpacking_failed:;
+ goto __pyx_L19_unpacking_done;
+ __pyx_L18_unpacking_failed:;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_13 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L20_unpacking_done:;
+ __pyx_L19_unpacking_done:;
}
- __Pyx_XDECREF(__pyx_v_fname);
- __pyx_v_fname = __pyx_t_1;
+ __Pyx_XDECREF_SET(__pyx_v_fname, __pyx_t_1);
__pyx_t_1 = 0;
- __Pyx_XDECREF(__pyx_v_value);
- __pyx_v_value = __pyx_t_11;
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5);
+ __pyx_t_5 = 0;
/* "cdec/_cdec.pyx":94
* if line.strip().startswith('#'): continue
* fname, value = line.split()
- * self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<<
+ * self.weights[fname.strip()] = float(value) * scaling # <<<<<<<<<<<<<<
*
* def translate(self, sentence, grammar=None):
*/
__pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_v_value); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s__strip); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_v_scaling); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fname, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_12) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->weights), __pyx_t_2, __pyx_t_5) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_L16_continue:;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "cdec/_cdec.pyx":91
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ * for line in fp: # <<<<<<<<<<<<<<
+ * if line.strip().startswith('#'): continue
+ * fname, value = line.split()
+ */
+ __pyx_L15_continue:;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* "cdec/_cdec.pyx":90
- * def read_weights(self, weights):
+ * def read_weights(self, weights, scaling = 1.0):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
@@ -20588,84 +23116,84 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
*/
/*except:*/ {
__Pyx_AddTraceback("cdec._cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_INCREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_16 = ((!(__pyx_t_10 != 0)) != 0);
+ if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_16 = ((!(__pyx_t_11 != 0)) != 0);
if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_1);
- __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_2);
+ __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- goto __pyx_L23;
}
- __pyx_L23:;
- __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
- if (__pyx_t_3) {
- __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_52, NULL);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ /*normal exit:*/{
+ if (__pyx_t_3) {
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__22, NULL);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
+ goto __pyx_L6;
}
+ __pyx_L6:;
}
- goto __pyx_L24;
+ goto __pyx_L23;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L24:;
+ __pyx_L23:;
}
+ /* "cdec/_cdec.pyx":88
+ * return str(conf[0]['formalism'].as_str().c_str())
+ *
+ * def read_weights(self, weights, scaling = 1.0): # <<<<<<<<<<<<<<
+ * """decoder.read_weights(filename): Read decoder weights from a file."""
+ * with open(weights) as fp:
+ */
+
+ /* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec._cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
@@ -20679,6 +23207,14 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(struct __pyx_obj_4
return __pyx_r;
}
+/* "cdec/_cdec.pyx":96
+ * self.weights[fname.strip()] = float(value) * scaling
+ *
+ * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
+ * """decoder.translate(sentence, grammar=None) -> Hypergraph
+ * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
+ */
+
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4cdec_5_cdec_7Decoder_6translate[] = "decoder.translate(sentence, grammar=None) -> Hypergraph\n Translate a sentence (string/Lattice) with a grammar (string/list of rules).";
@@ -20692,16 +23228,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("translate (wrapper)", 0);
{
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0};
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sentence,&__pyx_n_s_grammar,0};
PyObject* values[2] = {0,0};
-
- /* "cdec/_cdec.pyx":96
- * self.weights[fname.strip()] = float(value)
- *
- * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
- * """decoder.translate(sentence, grammar=None) -> Hypergraph
- * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
- */
values[1] = ((PyObject *)Py_None);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
@@ -20715,11 +23243,11 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
- if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sentence)) != 0)) kw_args--;
+ if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__grammar);
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grammar);
if (value) { values[1] = value; kw_args--; }
}
}
@@ -20746,6 +23274,8 @@ static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_sel
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_6translate(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), __pyx_v_sentence, __pyx_v_grammar);
+
+ /* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
@@ -20760,7 +23290,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- std::string __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
+ std::string __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -20784,16 +23315,31 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* elif isinstance(sentence, Lattice):
* input_str = str(sentence) # PLF format
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sentence, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_input_str = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = __pyx_f_4cdec_5_cdec_as_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_input_str = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
goto __pyx_L3;
}
@@ -20815,17 +23361,17 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* else:
* raise TypeError('Cannot translate input type %s' % type(sentence))
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_sentence);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sentence);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_sentence);
__Pyx_GIVEREF(__pyx_v_sentence);
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_input_str = ((PyObject*)__pyx_t_4);
- __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_input_str = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
@@ -20837,18 +23383,18 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* if grammar:
* if isinstance(grammar, basestring):
*/
- __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_53), ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_translate_input_type_s, ((PyObject *)Py_TYPE(__pyx_v_sentence))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
@@ -20881,11 +23427,11 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* else:
* self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0])
*/
- __pyx_t_4 = ((PyObject *)__pyx_f_4cdec_5_cdec_as_str(__pyx_v_grammar, NULL)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __pyx_convert_string_from_py_(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_self->dec->AddSupplementalGrammarFromString(__pyx_t_5);
+ __pyx_t_3 = __pyx_f_4cdec_5_cdec_as_str(__pyx_v_grammar, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = __pyx_convert_string_from_py_(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammarFromString(__pyx_t_6);
goto __pyx_L5;
}
/*else*/ {
@@ -20897,16 +23443,16 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
* self.dec.Decode(input_str, &observer)
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_grammar);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_grammar);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_grammar);
__Pyx_GIVEREF(__pyx_v_grammar);
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TextGrammar)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_t_3)->__pyx_base.grammar[0]));
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_TextGrammar)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_t_4)->__pyx_base.grammar[0]));
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L5:;
goto __pyx_L4;
@@ -20929,8 +23475,8 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* if observer.hypergraph == NULL:
* raise ParseFailed()
*/
- __pyx_t_5 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_input_str)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_self->dec->Decode(__pyx_t_5, (&__pyx_v_observer));
+ __pyx_t_6 = __pyx_convert_string_from_py_(__pyx_v_input_str); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_self->dec->Decode(__pyx_t_6, (&__pyx_v_observer));
/* "cdec/_cdec.pyx":113
* cdef decoder.BasicObserver observer = decoder.BasicObserver()
@@ -20949,17 +23495,30 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* cdef Hypergraph hg = Hypergraph()
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__ParseFailed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ParseFailed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
}
- __pyx_L6:;
/* "cdec/_cdec.pyx":115
* if observer.hypergraph == NULL:
@@ -20968,7 +23527,7 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
* hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0])
* return hg
*/
- __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Hypergraph)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_4);
__pyx_t_4 = 0;
@@ -20991,11 +23550,19 @@ static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_6translate(struct __pyx_obj_4cde
__pyx_r = ((PyObject *)__pyx_v_hg);
goto __pyx_L0;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
+ /* "cdec/_cdec.pyx":96
+ * self.weights[fname.strip()] = float(value) * scaling
+ *
+ * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<<
+ * """decoder.translate(sentence, grammar=None) -> Hypergraph
+ * Translate a sentence (string/Lattice) with a grammar (string/list of rules)."""
+ */
+
+ /* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec._cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -21019,6 +23586,10 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
char *__pyx_v_data;
std::string __pyx_r;
__Pyx_RefNannyDeclarations
+ char *__pyx_t_1;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_convert_string_from_py_", 0);
/* "string.from_py":15
@@ -21028,7 +23599,8 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
* return string(data, length)
*
*/
- __pyx_v_data = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length));
+ __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_data = __pyx_t_1;
/* "string.from_py":16
* cdef Py_ssize_t length
@@ -21040,86 +23612,508 @@ static std::string __pyx_convert_string_from_py_(PyObject *__pyx_v_o) {
__pyx_r = std::string(__pyx_v_data, __pyx_v_length);
goto __pyx_L0;
+ /* "string.from_py":13
+ *
+ * @cname("__pyx_convert_string_from_py_")
+ * cdef string __pyx_convert_string_from_py_(object o) except *: # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t length
+ * cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
} else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ return o;
+}
+
+static void __pyx_tp_dealloc_4cdec_5_cdec_DenseVector(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
+}
+
+static int __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(o, i, v);
+ }
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_DenseVector[] = {
+ {"dot", (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_14dot, METH_O, __pyx_doc_4cdec_5_cdec_11DenseVector_13dot},
+ {"tosparse", (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse},
+ {0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
+ __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_5_cdec_DenseVector, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
+ __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.DenseVector", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_DenseVector), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_DenseVector, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_DenseVector, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ __pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_4cdec_5_cdec_DenseVector, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_DenseVector, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o);
- p->__pyx_v_i = 0;
- p->__pyx_v_self = 0;
- p->__pyx_t_1 = 0;
+ if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_i);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_t_1);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_SparseVector(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
+}
+
+static int __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(o, i, v);
+ }
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SparseVector[] = {
+ {"copy", (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_5copy, METH_NOARGS, __pyx_doc_4cdec_5_cdec_12SparseVector_4copy},
+ {"dot", (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_14dot, METH_O, __pyx_doc_4cdec_5_cdec_12SparseVector_13dot},
+ {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_32__add__, /*nb_add*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_4cdec_5_cdec_12SparseVector_38__div__, /*nb_divide*/
+ #endif
+ 0, /*nb_remainder*/
+ 0, /*nb_divmod*/
+ 0, /*nb_power*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__, /*nb_negative*/
+ 0, /*nb_positive*/
+ 0, /*nb_absolute*/
+ 0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_coerce*/
+ #endif
+ 0, /*nb_int*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_long*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*nb_float*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_oct*/
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ 0, /*nb_hex*/
+ #endif
+ __pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
+ #if PY_MAJOR_VERSION < 3
+ __pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__, /*nb_inplace_divide*/
+ #endif
+ 0, /*nb_inplace_remainder*/
+ 0, /*nb_inplace_power*/
+ 0, /*nb_inplace_lshift*/
+ 0, /*nb_inplace_rshift*/
+ 0, /*nb_inplace_and*/
+ 0, /*nb_inplace_xor*/
+ 0, /*nb_inplace_or*/
+ 0, /*nb_floor_divide*/
+ 0, /*nb_true_divide*/
+ 0, /*nb_inplace_floor_divide*/
+ 0, /*nb_inplace_true_divide*/
+ 0, /*nb_index*/
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_matrix_multiply*/
+ #endif
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_inplace_matrix_multiply*/
+ #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_5_cdec_SparseVector, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
+ __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.SparseVector", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SparseVector), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SparseVector, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ &__pyx_tp_as_number_SparseVector, /*tp_as_number*/
+ &__pyx_tp_as_sequence_SparseVector, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_SparseVector, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_4cdec_5_cdec_SparseVector, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_SparseVector, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_NT *p;
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
} else {
- (*Py_TYPE(o)->tp_free)(o);
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_NT *)o);
+ p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ return o;
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
- if (p->__pyx_v_i) {
- e = (*v)(p->__pyx_v_i, a); if (e) return e;
+static void __pyx_tp_dealloc_4cdec_5_cdec_NT(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ #endif
+ Py_CLEAR(p->cat);
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(o, v);
}
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ else {
+ return __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(o);
}
- return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_i);
- p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_NT[] = {
+ {0, 0, 0, 0}
+};
+
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NT[] = {
+ {(char *)"cat", __pyx_getprop_4cdec_5_cdec_2NT_cat, __pyx_setprop_4cdec_5_cdec_2NT_cat, 0, 0},
+ {(char *)"ref", __pyx_getprop_4cdec_5_cdec_2NT_ref, __pyx_setprop_4cdec_5_cdec_2NT_ref, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec._cdec.NT", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_NT), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_5_cdec_NT, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
+ #endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_2NT_3__str__, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ __pyx_methods_4cdec_5_cdec_NT, /*tp_methods*/
+ 0, /*tp_members*/
+ __pyx_getsets_4cdec_5_cdec_NT, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ __pyx_pw_4cdec_5_cdec_2NT_1__init__, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_5_cdec_NT, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ return o;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___iter__[] = {
+static void __pyx_tp_dealloc_4cdec_5_cdec_NTRef(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
+ (*Py_TYPE(o)->tp_free)(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(o);
+}
+
+static int __pyx_setprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(o, v);
+ }
+ else {
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_NTRef[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NTRef[] = {
+ {(char *)"ref", __pyx_getprop_4cdec_5_cdec_5NTRef_ref, __pyx_setprop_4cdec_5_cdec_5NTRef_ref, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_24___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___iter__), /*tp_basicsize*/
+ "cdec._cdec.NTRef", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_NTRef), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_NTRef, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21134,29 +24128,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_4cdec_5_cdec_5NTRef_3__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_NTRef, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_NTRef, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_5NTRef_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_NTRef, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21165,25 +24159,34 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
static PyObject *__pyx_tp_new_4cdec_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_4cdec_5_cdec_TRule(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_pw_4cdec_5_cdec_5TRule_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
@@ -21280,7 +24283,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_TRule[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_TRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.TRule"), /*tp_name*/
+ "cdec._cdec.TRule", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_TRule), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_TRule, /*tp_dealloc*/
@@ -21329,8 +24332,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_TRule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -21346,7 +24350,7 @@ static PyMethodDef __pyx_methods_4cdec_5_cdec_MRule[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_MRule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.MRule"), /*tp_name*/
+ "cdec._cdec.MRule", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_MRule), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_TRule, /*tp_dealloc*/
@@ -21399,80 +24403,69 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_MRule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_DenseVector(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_Grammar(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_11DenseVector_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_DenseVector(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(o);
}
-static int __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) {
+static int __pyx_setprop_4cdec_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(o, i, v);
+ return __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(o, v);
}
else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
return -1;
}
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_DenseVector[] = {
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_11DenseVector_13dot)},
- {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_11DenseVector_15tosparse)},
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Grammar[] = {
{0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_DenseVector = {
- __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_DenseVector, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- 0, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_DenseVector = {
- __pyx_pw_4cdec_5_cdec_11DenseVector_5__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector, /*mp_ass_subscript*/
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Grammar[] = {
+ {(char *)"name", __pyx_getprop_4cdec_5_cdec_7Grammar_name, __pyx_setprop_4cdec_5_cdec_7Grammar_name, 0, 0},
+ {0, 0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.DenseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_DenseVector), /*tp_basicsize*/
+ "cdec._cdec.Grammar", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Grammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_DenseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21483,8 +24476,8 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_DenseVector, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -21497,19 +24490,19 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_DenseVector, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Grammar, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_Grammar, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_DenseVector, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Grammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21518,139 +24511,28 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
+ PyObject *o = __pyx_tp_new_4cdec_5_cdec_Grammar(t, a, k);
if (unlikely(!o)) return 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_15SufficientStats_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
- (*Py_TYPE(o)->tp_free)(o);
-}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(o);
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_SufficientStats[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_TextGrammar[] = {
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_SufficientStats[] = {
- {(char *)"score", __pyx_getprop_4cdec_5_cdec_15SufficientStats_score, 0, 0, 0},
- {(char *)"detail", __pyx_getprop_4cdec_5_cdec_15SufficientStats_detail, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
- __pyx_pw_4cdec_5_cdec_15SufficientStats_12__add__, /*nb_add*/
- 0, /*nb_subtract*/
- 0, /*nb_multiply*/
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_divide*/
- #endif
- 0, /*nb_remainder*/
- 0, /*nb_divmod*/
- 0, /*nb_power*/
- 0, /*nb_negative*/
- 0, /*nb_positive*/
- 0, /*nb_absolute*/
- 0, /*nb_nonzero*/
- 0, /*nb_invert*/
- 0, /*nb_lshift*/
- 0, /*nb_rshift*/
- 0, /*nb_and*/
- 0, /*nb_xor*/
- 0, /*nb_or*/
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_coerce*/
- #endif
- 0, /*nb_int*/
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_long*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*nb_float*/
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_oct*/
- #endif
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_hex*/
- #endif
- __pyx_pw_4cdec_5_cdec_15SufficientStats_10__iadd__, /*nb_inplace_add*/
- 0, /*nb_inplace_subtract*/
- 0, /*nb_inplace_multiply*/
- #if PY_MAJOR_VERSION < 3
- 0, /*nb_inplace_divide*/
- #endif
- 0, /*nb_inplace_remainder*/
- 0, /*nb_inplace_power*/
- 0, /*nb_inplace_lshift*/
- 0, /*nb_inplace_rshift*/
- 0, /*nb_inplace_and*/
- 0, /*nb_inplace_xor*/
- 0, /*nb_inplace_or*/
- 0, /*nb_floor_divide*/
- 0, /*nb_true_divide*/
- 0, /*nb_inplace_floor_divide*/
- 0, /*nb_inplace_true_divide*/
- #if PY_VERSION_HEX >= 0x02050000
- 0, /*nb_index*/
- #endif
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_SufficientStats = {
- __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_SufficientStats, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- 0, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_SufficientStats = {
- __pyx_pw_4cdec_5_cdec_15SufficientStats_3__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_15SufficientStats_8__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SufficientStats"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SufficientStats), /*tp_basicsize*/
+ "cdec._cdec.TextGrammar", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_TextGrammar), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21660,9 +24542,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_SufficientStats, /*tp_as_number*/
- &__pyx_tp_as_sequence_SufficientStats, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_SufficientStats, /*tp_as_mapping*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -21675,19 +24557,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/
+ #if CYTHON_COMPILING_IN_PYPY
+ __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ #else
+ 0, /*tp_iter*/
+ #endif
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SufficientStats, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_TextGrammar, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_SufficientStats, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SufficientStats, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_TextGrammar, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21696,118 +24582,98 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph __pyx_vtable_4cdec_5_cdec_Hypergraph;
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Hypergraph *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_delta = 0;
- p->__pyx_v_i = 0;
- p->__pyx_v_label = 0;
- p->__pyx_v_weight = 0;
- p->__pyx_t_1 = 0;
- p->__pyx_t_3 = 0;
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_Hypergraph;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_delta);
- Py_CLEAR(p->__pyx_v_i);
- Py_CLEAR(p->__pyx_v_label);
- Py_CLEAR(p->__pyx_v_weight);
- Py_CLEAR(p->__pyx_t_1);
- Py_CLEAR(p->__pyx_t_3);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_lines[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_lines++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_delta) {
- e = (*v)(p->__pyx_v_delta, a); if (e) return e;
- }
- if (p->__pyx_v_i) {
- e = (*v)(p->__pyx_v_i, a); if (e) return e;
- }
- if (p->__pyx_v_label) {
- e = (*v)(p->__pyx_v_label, a); if (e) return e;
- }
- if (p->__pyx_v_weight) {
- e = (*v)(p->__pyx_v_weight, a); if (e) return e;
- }
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
- }
- if (p->__pyx_t_3) {
- e = (*v)(p->__pyx_t_3, a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(o);
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_delta);
- p->__pyx_v_delta = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_i);
- p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_label);
- p->__pyx_v_label = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_weight);
- p->__pyx_v_weight = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_3);
- p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23_lines[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Hypergraph[] = {
+ {"viterbi", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi},
+ {"viterbi_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees},
+ {"viterbi_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features},
+ {"viterbi_forest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, 0},
+ {"viterbi_joshua", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua},
+ {"kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest},
+ {"kbest_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees},
+ {"kbest_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features},
+ {"unique_kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest},
+ {"unique_kbest_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees},
+ {"unique_kbest_features", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features},
+ {"sample", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_30sample},
+ {"sample_hypotheses", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_hypotheses, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_hypotheses},
+ {"sample_trees", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_37sample_trees, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_36sample_trees},
+ {"intersect", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_40intersect, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_39intersect},
+ {"prune", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_42prune, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_10Hypergraph_41prune},
+ {"lattice", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_44lattice, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_43lattice},
+ {"plf", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_46plf, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_45plf},
+ {"reweight", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_48reweight, METH_O, __pyx_doc_4cdec_5_cdec_10Hypergraph_47reweight},
+ {"inside_outside", (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_50inside_outside, METH_NOARGS, __pyx_doc_4cdec_5_cdec_10Hypergraph_49inside_outside},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Hypergraph[] = {
+ {(char *)"edges", __pyx_getprop_4cdec_5_cdec_10Hypergraph_edges, 0, 0, 0},
+ {(char *)"nodes", __pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes, 0, 0, 0},
+ {(char *)"goal", __pyx_getprop_4cdec_5_cdec_10Hypergraph_goal, 0, 0, 0},
+ {(char *)"npaths", __pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_23_lines"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_lines), /*tp_basicsize*/
+ "cdec._cdec.Hypergraph", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Hypergraph), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -21826,17 +24692,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Hypergraph, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_Hypergraph, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -21844,7 +24710,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_lines, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Hypergraph, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -21853,179 +24719,135 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge __pyx_vtable_4cdec_5_cdec_HypergraphEdge;
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o);
- p->__pyx_v_config = 0;
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
+ p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_config);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27___init__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27___init__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->trule);
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
- if (p->__pyx_v_config) {
- e = (*v)(p->__pyx_v_config, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ if (p->trule) {
+ e = (*v)(((PyObject*)p->trule), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_config);
- p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+ tmp = ((PyObject*)p->trule);
+ p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_27___init__[] = {
- {0, 0, 0, 0}
-};
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__ = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_27___init__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- 0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_methods*/
- 0, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27___init__, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
- #endif
-};
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
+}
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ = 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(o);
+}
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p;
- PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- }
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o);
- p->__pyx_v_self = 0;
- return o;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
- }
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
- }
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(o);
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__[] = {
+static int __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ }
+ else {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ }
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphEdge[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphEdge[] = {
+ {(char *)"head_node", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
+ {(char *)"tail_nodes", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
+ {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span, 0, 0, 0},
+ {(char *)"src_span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
+ {(char *)"feature_values", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
+ {(char *)"prob", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
+ {(char *)"trule", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule, __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = {
+ __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ 0, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_HypergraphEdge = {
+ __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
+ 0, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/
+ "cdec._cdec.HypergraphEdge", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22036,25 +24858,25 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_HypergraphEdge, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/
- 0, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge, /*tp_clear*/
+ __pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_HypergraphEdge, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_HypergraphEdge, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -22062,7 +24884,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_HypergraphEdge, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22071,61 +24893,75 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
+static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode __pyx_vtable_4cdec_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_HypergraphNode *p;
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Metric *)o);
- p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
- if (unlikely(__pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
- Py_DECREF(o); o = 0;
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
}
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)o);
+ p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->scorer);
+static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- if (p->scorer) {
- e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
- }
- return 0;
+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 int __pyx_tp_clear_4cdec_5_cdec_Metric(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->scorer);
- p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+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);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Metric[] = {
- {__Pyx_NAMESTR("score"), (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_5score, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(o);
+}
+
+static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = {
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
+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},
+ {(char *)"cat", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Metric"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Metric), /*tp_basicsize*/
+ "cdec._cdec.HypergraphNode", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphNode), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Metric, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22139,22 +24975,22 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_4cdec_5_cdec_6Metric_3__call__, /*tp_call*/
+ 0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec_Metric, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_Metric, /*tp_clear*/
- 0, /*tp_richcompare*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ __pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Metric, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_HypergraphNode, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_HypergraphNode, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -22162,7 +24998,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Metric, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_HypergraphNode, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22171,78 +25007,93 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Lattice(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ (*Py_TYPE(o)->tp_free)(o);
+}
+static PyObject *__pyx_sq_item_4cdec_5_cdec_Lattice(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+static int __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
+ if (v) {
+ return __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(o, i, v);
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ else {
+ PyErr_Format(PyExc_NotImplementedError,
+ "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
+ return -1;
}
- return 0;
-}
-
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Lattice[] = {
+ {"__unicode__", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__, METH_NOARGS, 0},
+ {"todot", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_20todot, METH_NOARGS, __pyx_doc_4cdec_5_cdec_7Lattice_19todot},
+ {"as_hypergraph", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = {
+static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
+ __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_5_cdec_Lattice, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_Lattice = {
+ __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
+ __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_11_unique_kbest"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest), /*tp_basicsize*/
+ "cdec._cdec.Lattice", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Lattice), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Lattice, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22253,23 +25104,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__pyx_tp_as_sequence_Lattice, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- 0, /*tp_str*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_13__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_17__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Lattice, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22277,9 +25128,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_7Lattice_3__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Lattice, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22288,19 +25139,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
return o;
}
static void __pyx_tp_dealloc_4cdec_5_cdec_Candidate(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
(*Py_TYPE(o)->tp_free)(o);
}
@@ -22326,10 +25187,6 @@ static int __pyx_setprop_4cdec_5_cdec_9Candidate_score(PyObject *o, PyObject *v,
}
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Candidate[] = {
- {0, 0, 0, 0}
-};
-
static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Candidate[] = {
{(char *)"words", __pyx_getprop_4cdec_5_cdec_9Candidate_words, 0, 0, 0},
{(char *)"fmap", __pyx_getprop_4cdec_5_cdec_9Candidate_fmap, 0, 0, 0},
@@ -22339,7 +25196,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Candidate[] = {
static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Candidate"), /*tp_name*/
+ "cdec._cdec.Candidate", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec_Candidate), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec_Candidate, /*tp_dealloc*/
@@ -22369,7 +25226,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Candidate, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_4cdec_5_cdec_Candidate, /*tp_getset*/
0, /*tp_base*/
@@ -22388,31 +25245,43 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_15SufficientStats_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_SparseVector(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_12SparseVector_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_SparseVector(PyObject *o, Py_ssize_t i) {
+static PyObject *__pyx_sq_item_4cdec_5_cdec_SufficientStats(PyObject *o, Py_ssize_t i) {
PyObject *r;
PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
@@ -22420,34 +25289,35 @@ static PyObject *__pyx_sq_item_4cdec_5_cdec_SparseVector(PyObject *o, Py_ssize_t
return r;
}
-static int __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_12SparseVector_9__setitem__(o, i, v);
- }
- else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
- return -1;
- }
+static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_15SufficientStats_5score_1__get__(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_SparseVector[] = {
- {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12SparseVector_4copy)},
- {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12SparseVector_13dot)},
+static PyObject *__pyx_getprop_4cdec_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_15SufficientStats_6detail_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SufficientStats[] = {
{0, 0, 0, 0}
};
-static PyNumberMethods __pyx_tp_as_number_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_32__add__, /*nb_add*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_SufficientStats[] = {
+ {(char *)"score", __pyx_getprop_4cdec_5_cdec_15SufficientStats_score, 0, 0, 0},
+ {(char *)"detail", __pyx_getprop_4cdec_5_cdec_15SufficientStats_detail, 0, 0, 0},
+ {0, 0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_14__add__, /*nb_add*/
+ 0, /*nb_subtract*/
+ 0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
- __pyx_pw_4cdec_5_cdec_12SparseVector_38__div__, /*nb_divide*/
+ 0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_22__neg__, /*nb_negative*/
+ 0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
@@ -22473,11 +25343,11 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = {
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
- __pyx_pw_4cdec_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_12__iadd__, /*nb_inplace_add*/
+ 0, /*nb_inplace_subtract*/
+ 0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
- __pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__, /*nb_inplace_divide*/
+ 0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
@@ -22490,36 +25360,40 @@ static PyNumberMethods __pyx_tp_as_number_SparseVector = {
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
- #if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_matrix_multiply*/
+ #endif
+ #if PY_VERSION_HEX >= 0x03050000
+ 0, /*nb_inplace_matrix_multiply*/
#endif
};
-static PySequenceMethods __pyx_tp_as_sequence_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*sq_length*/
+static PySequenceMethods __pyx_tp_as_sequence_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_SparseVector, /*sq_item*/
+ __pyx_sq_item_4cdec_5_cdec_SufficientStats, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__, /*sq_contains*/
+ 0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
-static PyMappingMethods __pyx_tp_as_mapping_SparseVector = {
- __pyx_pw_4cdec_5_cdec_12SparseVector_18__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_SparseVector, /*mp_ass_subscript*/
+static PyMappingMethods __pyx_tp_as_mapping_SufficientStats = {
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_10__getitem__, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
};
-static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SparseVector"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SparseVector), /*tp_basicsize*/
+ "cdec._cdec.SufficientStats", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SufficientStats), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SparseVector, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22529,9 +25403,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
0, /*reserved*/
#endif
0, /*tp_repr*/
- &__pyx_tp_as_number_SparseVector, /*tp_as_number*/
- &__pyx_tp_as_sequence_SparseVector, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_SparseVector, /*tp_as_mapping*/
+ &__pyx_tp_as_number_SufficientStats, /*tp_as_number*/
+ &__pyx_tp_as_sequence_SufficientStats, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_SufficientStats, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -22542,21 +25416,21 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_15SufficientStats_7__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SparseVector, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_SufficientStats, /*tp_methods*/
0, /*tp_members*/
- 0, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_SufficientStats, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SparseVector, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_SufficientStats, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22565,118 +25439,80 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- }
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o);
- p->__pyx_v_config = 0;
- p->__pyx_v_info = 0;
- p->__pyx_v_key = 0;
- p->__pyx_v_name = 0;
- p->__pyx_v_value = 0;
- p->__pyx_t_0 = 0;
- p->__pyx_t_1 = 0;
- return o;
-}
-
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_config);
- Py_CLEAR(p->__pyx_v_info);
- Py_CLEAR(p->__pyx_v_key);
- Py_CLEAR(p->__pyx_v_name);
- Py_CLEAR(p->__pyx_v_value);
- Py_CLEAR(p->__pyx_t_0);
- Py_CLEAR(p->__pyx_t_1);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26__make_config[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26__make_config++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o);
} else {
- (*Py_TYPE(o)->tp_free)(o);
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ if (unlikely(__pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) {
+ Py_DECREF(o); o = 0;
}
+ return o;
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- if (p->__pyx_v_config) {
- e = (*v)(p->__pyx_v_config, a); if (e) return e;
- }
- if (p->__pyx_v_info) {
- e = (*v)(p->__pyx_v_info, a); if (e) return e;
- }
- if (p->__pyx_v_key) {
- e = (*v)(p->__pyx_v_key, a); if (e) return e;
- }
- if (p->__pyx_v_name) {
- e = (*v)(p->__pyx_v_name, a); if (e) return e;
- }
- if (p->__pyx_v_value) {
- e = (*v)(p->__pyx_v_value, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+static void __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- if (p->__pyx_t_1) {
- e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
- return 0;
+ (*Py_TYPE(o)->tp_free)(o);
}
-
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_config);
- p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_info);
- p->__pyx_v_info = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_key);
- p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_name);
- p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_value);
- p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_0);
- p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_1);
- p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
+static PyObject *__pyx_sq_item_4cdec_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) {
+ PyObject *r;
+ PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
+ r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
+ Py_DECREF(x);
+ return r;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_26__make_config[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_CandidateSet[] = {
+ {"add_kbest", (PyCFunction)__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config = {
+static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = {
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*sq_length*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
+ __pyx_sq_item_4cdec_5_cdec_CandidateSet, /*sq_item*/
+ 0, /*sq_slice*/
+ 0, /*sq_ass_item*/
+ 0, /*sq_ass_slice*/
+ 0, /*sq_contains*/
+ 0, /*sq_inplace_concat*/
+ 0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*mp_length*/
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
+ 0, /*mp_ass_subscript*/
+};
+
+static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_26__make_config"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26__make_config), /*tp_basicsize*/
+ "cdec._cdec.CandidateSet", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_CandidateSet), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22687,23 +25523,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
+ &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/
+ &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
+ __pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_CandidateSet, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22713,7 +25549,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26__make_config, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_CandidateSet, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22722,89 +25558,52 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_NT *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_NT *)o);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->cat);
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static int __pyx_tp_traverse_4cdec_5_cdec_NT(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- if (p->cat) {
- e = (*v)(p->cat, a); if (e) return e;
- }
- return 0;
-}
-
-static int __pyx_tp_clear_4cdec_5_cdec_NT(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_NT *p = (struct __pyx_obj_4cdec_5_cdec_NT *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->cat);
- p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- return 0;
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(o, v);
- }
- else {
- return __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(o);
- }
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_2NT_3ref_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(o, v);
+static void __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+ #endif
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
}
+ (*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_NT[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_SegmentEvaluator[] = {
+ {"evaluate", (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate},
+ {"candidate_set", (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NT[] = {
- {(char *)"cat", __pyx_getprop_4cdec_5_cdec_2NT_cat, __pyx_setprop_4cdec_5_cdec_2NT_cat, 0, 0},
- {(char *)"ref", __pyx_getprop_4cdec_5_cdec_2NT_ref, __pyx_setprop_4cdec_5_cdec_2NT_ref, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.NT"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_NT), /*tp_basicsize*/
+ "cdec._cdec.SegmentEvaluator", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_NT, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22819,29 +25618,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_2NT_3__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec_NT, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_NT, /*tp_clear*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_NT, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_SegmentEvaluator, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_NT, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_2NT_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_NT, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_SegmentEvaluator, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22850,84 +25649,53 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NT = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- if (unlikely(__pyx_pw_4cdec_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ if (unlikely(__pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) {
Py_DECREF(o); o = 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Lattice(PyObject *o) {
+static void __pyx_tp_dealloc_4cdec_5_cdec_Scorer(PyObject *o) {
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_7Lattice_5__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
+ __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_Lattice(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
-}
-
-static int __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Lattice_9__setitem__(o, i, v);
- }
- else {
- PyErr_Format(PyExc_NotImplementedError,
- "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
- return -1;
- }
-}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Lattice[] = {
- {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Lattice_19todot)},
- {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Lattice_21as_hypergraph)},
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Scorer[] = {
{0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_Lattice = {
- __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_Lattice, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- 0, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_Lattice = {
- __pyx_pw_4cdec_5_cdec_7Lattice_11__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/
- __pyx_mp_ass_subscript_4cdec_5_cdec_Lattice, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Lattice"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Lattice), /*tp_basicsize*/
+ "cdec._cdec.Scorer", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Scorer), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Lattice, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Scorer, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -22938,11 +25706,11 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_Lattice, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_Lattice, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
- 0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_7Lattice_13__str__, /*tp_str*/
+ __pyx_pw_4cdec_5_cdec_6Scorer_5__call__, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_6Scorer_7__str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
@@ -22952,9 +25720,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_7Lattice_17__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Lattice, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Scorer, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -22962,9 +25730,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_7Lattice_3__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Lattice, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Scorer, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -22973,70 +25741,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Lattice = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = 0;
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Metric *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees));
- PyObject_INIT(o, t);
- PyObject_GC_Track(o);
- } else {
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
+ if (unlikely(!o)) return 0;
+ p = ((struct __pyx_obj_4cdec_5_cdec_Metric *)o);
+ p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
+ if (unlikely(__pyx_pw_4cdec_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
+ Py_DECREF(o); o = 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
- PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o);
- } else {
- (*Py_TYPE(o)->tp_free)(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec_Metric(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
}
+ #endif
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->scorer);
+ (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_Metric(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ if (p->scorer) {
+ e = (*v)(((PyObject*)p->scorer), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_Metric(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_Metric *p = (struct __pyx_obj_4cdec_5_cdec_Metric *)o;
+ tmp = ((PyObject*)p->scorer);
+ p->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15_sample_trees[] = {
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Metric[] = {
+ {"score", (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_5score, METH_NOARGS, 0},
+ {"evaluate", (PyCFunction)__pyx_pw_4cdec_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_15_sample_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_trees), /*tp_basicsize*/
+ "cdec._cdec.Metric", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Metric), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Metric, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23050,20 +25819,20 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- 0, /*tp_call*/
+ __pyx_pw_4cdec_5_cdec_6Metric_3__call__, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec_Metric, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_Metric, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Metric, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23073,7 +25842,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_trees, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Metric, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23082,125 +25851,100 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge __pyx_vtable_4cdec_5_cdec_HypergraphEdge;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p;
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
+ if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
+ o = (*t->tp_alloc)(t, 0);
+ } else {
+ o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
+ }
if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge;
- p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p = ((struct __pyx_obj_4cdec_5_cdec_Decoder *)o);
+ p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec_Decoder(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ #if PY_VERSION_HEX >= 0x030400a1
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
+ if (PyObject_CallFinalizerFromDealloc(o)) return;
+ }
+ #endif
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->trule);
+ {
+ PyObject *etype, *eval, *etb;
+ PyErr_Fetch(&etype, &eval, &etb);
+ ++Py_REFCNT(o);
+ __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(o);
+ --Py_REFCNT(o);
+ PyErr_Restore(etype, eval, etb);
+ }
+ Py_CLEAR(p->weights);
(*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
- if (p->trule) {
- e = (*v)(((PyObject*)p->trule), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ if (p->weights) {
+ e = (*v)(((PyObject*)p->weights), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o;
+static int __pyx_tp_clear_4cdec_5_cdec_Decoder(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->trule);
- p->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+ tmp = ((PyObject*)p->weights);
+ p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_9head_node_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_8src_span_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_14feature_values_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_4prob_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_1__get__(o);
+static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(o);
}
-static int __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
+static int __pyx_setprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
if (v) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(o, v);
+ return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(o, v);
}
else {
- return __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(o);
+ PyErr_SetString(PyExc_NotImplementedError, "__del__");
+ return -1;
}
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphEdge[] = {
+static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
+ return __pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(o);
+}
+
+static PyMethodDef __pyx_methods_4cdec_5_cdec_Decoder[] = {
+ {"read_weights", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_7Decoder_4read_weights},
+ {"translate", (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_5_cdec_7Decoder_6translate},
{0, 0, 0, 0}
};
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphEdge[] = {
- {(char *)"head_node", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_head_node, 0, 0, 0},
- {(char *)"tail_nodes", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0},
- {(char *)"span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_span, 0, 0, 0},
- {(char *)"src_span", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_src_span, 0, 0, 0},
- {(char *)"feature_values", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0},
- {(char *)"prob", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_prob, 0, 0, 0},
- {(char *)"trule", __pyx_getprop_4cdec_5_cdec_14HypergraphEdge_trule, __pyx_setprop_4cdec_5_cdec_14HypergraphEdge_trule, 0, 0},
+static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Decoder[] = {
+ {(char *)"weights", __pyx_getprop_4cdec_5_cdec_7Decoder_weights, __pyx_setprop_4cdec_5_cdec_7Decoder_weights, 0, 0},
+ {(char *)"formalism", __pyx_getprop_4cdec_5_cdec_7Decoder_formalism, 0, 0, 0},
{0, 0, 0, 0, 0}
};
-static PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = {
- __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- 0, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- 0, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
-
-static PyMappingMethods __pyx_tp_as_mapping_HypergraphEdge = {
- __pyx_pw_4cdec_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/
- 0, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
+static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.HypergraphEdge"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge), /*tp_basicsize*/
+ "cdec._cdec.Decoder", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec_Decoder), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec_Decoder, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23211,8 +25955,8 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_HypergraphEdge, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_HypergraphEdge, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
@@ -23221,23 +25965,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_HypergraphEdge, /*tp_clear*/
- __pyx_pw_4cdec_5_cdec_14HypergraphEdge_3__richcmp__, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec_Decoder, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec_Decoder, /*tp_clear*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_HypergraphEdge, /*tp_methods*/
+ __pyx_methods_4cdec_5_cdec_Decoder, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_HypergraphEdge, /*tp_getset*/
+ __pyx_getsets_4cdec_5_cdec_Decoder, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
+ __pyx_pw_4cdec_5_cdec_7Decoder_1__init__, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_HypergraphEdge, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec_Decoder, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23246,70 +25990,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphEdge = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
- p->__pyx_v_phrase = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_phrase);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
- if (p->__pyx_v_phrase) {
- e = (*v)(p->__pyx_v_phrase, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_phrase);
- p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_2__phrase"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct____iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23330,13 +26068,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23346,7 +26084,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23355,44 +26093,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- if (unlikely(__pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) {
- Py_DECREF(o); o = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Scorer(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_6Scorer_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Scorer[] = {
- {0, 0, 0, 0}
-};
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Scorer"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Scorer), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_1___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Scorer, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23406,20 +26164,20 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
- __pyx_pw_4cdec_5_cdec_6Scorer_5__call__, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_6Scorer_7__str__, /*tp_str*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Scorer, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23429,7 +26187,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Scorer, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23438,65 +26196,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode __pyx_vtable_4cdec_5_cdec_HypergraphNode;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_HypergraphNode *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_HypergraphNode;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-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);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_phrase);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_4span_1__get__(o);
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+ if (p->__pyx_v_phrase) {
+ e = (*v)(p->__pyx_v_phrase, a); if (e) return e;
+ }
+ return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_14HypergraphNode_3cat_1__get__(o);
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)o;
+ tmp = ((PyObject*)p->__pyx_v_phrase);
+ p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = {
- {0, 0, 0, 0}
-};
-
-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},
- {(char *)"cat", __pyx_getprop_4cdec_5_cdec_14HypergraphNode_cat, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.HypergraphNode"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphNode), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_2__phrase", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23515,17 +26272,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- __pyx_pw_4cdec_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/
+ 0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_HypergraphNode, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_HypergraphNode, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23533,7 +26290,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_HypergraphNode, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23542,86 +26299,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o);
- p->__pyx_v_fmap = 0;
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_fmap);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_w);
+ Py_CLEAR(p->__pyx_t_0);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
- if (p->__pyx_v_fmap) {
- e = (*v)(((PyObject*)p->__pyx_v_fmap), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ if (p->__pyx_v_w) {
+ e = (*v)(p->__pyx_v_w, a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_fmap);
- p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_w);
+ p->__pyx_v_w = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_10_kbest_features"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_3_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23642,13 +26391,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -23658,7 +26407,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23667,51 +26416,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_NTRef(PyObject *o) {
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_1__get__(o);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
}
-static int __pyx_setprop_4cdec_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_NTRef[] = {
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_NTRef[] = {
- {(char *)"ref", __pyx_getprop_4cdec_5_cdec_5NTRef_ref, __pyx_setprop_4cdec_5_cdec_5NTRef_ref, 0, 0},
- {0, 0, 0, 0, 0}
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.NTRef"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_NTRef), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_4___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_NTRef, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23726,29 +26488,29 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
- __pyx_pw_4cdec_5_cdec_5NTRef_3__str__, /*tp_str*/
+ 0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_NTRef, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_NTRef, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_5NTRef_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_NTRef, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23757,60 +26519,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Grammar(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Grammar(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_7Grammar_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Grammar_4name_1__get__(o);
}
-static int __pyx_setprop_4cdec_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Grammar_4name_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Grammar[] = {
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Grammar[] = {
- {(char *)"name", __pyx_getprop_4cdec_5_cdec_7Grammar_name, __pyx_setprop_4cdec_5_cdec_7Grammar_name, 0, 0},
- {0, 0, 0, 0, 0}
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Grammar"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Grammar), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_5___str__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23829,17 +26595,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Grammar, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Grammar, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23847,7 +26613,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Grammar, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23856,88 +26622,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Grammar = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph __pyx_vtable_4cdec_5_cdec_Hypergraph;
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Hypergraph *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)o);
- p->__pyx_vtab = __pyx_vtabptr_4cdec_5_cdec_Hypergraph;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_10Hypergraph_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_feat);
+ Py_CLEAR(p->__pyx_t_0);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(o);
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(o);
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_4goal_1__get__(o);
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_feat) {
+ e = (*v)(p->__pyx_v_feat, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_10Hypergraph_6npaths_1__get__(o);
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_feat);
+ p->__pyx_v_feat = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Hypergraph[] = {
- {__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_2viterbi)},
- {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_4viterbi_trees)},
- {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_6viterbi_features)},
- {__Pyx_NAMESTR("viterbi_forest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_10viterbi_joshua)},
- {__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_12kbest)},
- {__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_15kbest_trees)},
- {__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_18kbest_features)},
- {__Pyx_NAMESTR("unique_kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_22unique_kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_21unique_kbest)},
- {__Pyx_NAMESTR("unique_kbest_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_25unique_kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_24unique_kbest_trees)},
- {__Pyx_NAMESTR("unique_kbest_features"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_28unique_kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_27unique_kbest_features)},
- {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_31sample, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_30sample)},
- {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_34sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_33sample_trees)},
- {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_37intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_36intersect)},
- {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_39prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_38prune)},
- {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_41lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_40lattice)},
- {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_43plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_42plf)},
- {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_45reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_44reweight)},
- {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_47inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_46inside_outside)},
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Hypergraph[] = {
- {(char *)"edges", __pyx_getprop_4cdec_5_cdec_10Hypergraph_edges, 0, 0, 0},
- {(char *)"nodes", __pyx_getprop_4cdec_5_cdec_10Hypergraph_nodes, 0, 0, 0},
- {(char *)"goal", __pyx_getprop_4cdec_5_cdec_10Hypergraph_goal, 0, 0, 0},
- {(char *)"npaths", __pyx_getprop_4cdec_5_cdec_10Hypergraph_npaths, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Hypergraph"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Hypergraph), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_6_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -23956,17 +26712,17 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Hypergraph, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Hypergraph, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
@@ -23974,7 +26730,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Hypergraph, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -23983,71 +26739,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Hypergraph = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) {
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- if (unlikely(__pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) {
- Py_DECREF(o); o = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
}
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ Py_CLEAR(p->__pyx_v_trule);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- (*Py_TYPE(o)->tp_free)(o);
-}
-static PyObject *__pyx_sq_item_4cdec_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) {
- PyObject *r;
- PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
- r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
- Py_DECREF(x);
- return r;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_CandidateSet[] = {
- {__Pyx_NAMESTR("add_kbest"), (PyCFunction)__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_12CandidateSet_11add_kbest)},
- {0, 0, 0, 0}
-};
-
-static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = {
- __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*sq_length*/
- 0, /*sq_concat*/
- 0, /*sq_repeat*/
- __pyx_sq_item_4cdec_5_cdec_CandidateSet, /*sq_item*/
- 0, /*sq_slice*/
- 0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
- 0, /*sq_contains*/
- 0, /*sq_inplace_concat*/
- 0, /*sq_inplace_repeat*/
-};
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ if (p->__pyx_v_trule) {
+ e = (*v)(((PyObject*)p->__pyx_v_trule), a); if (e) return e;
+ }
+ return 0;
+}
-static PyMappingMethods __pyx_tp_as_mapping_CandidateSet = {
- __pyx_pw_4cdec_5_cdec_12CandidateSet_5__len__, /*mp_length*/
- __pyx_pw_4cdec_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/
- 0, /*mp_ass_subscript*/
-};
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Grammar *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_trule);
+ p->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.CandidateSet"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_CandidateSet), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_7___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24058,23 +26814,23 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
#endif
0, /*tp_repr*/
0, /*tp_as_number*/
- &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/
- &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- __pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/
+ 0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_CandidateSet, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24084,7 +26840,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_CandidateSet, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24093,70 +26849,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22_todot[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22_todot++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22_todot(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_22_todot[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_22_todot"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22_todot), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_8_kbest", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24177,13 +26934,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24193,7 +26950,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22_todot, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24202,8 +26959,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -24211,22 +26969,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_fre
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
- p->__pyx_v_e_tree = 0;
- p->__pyx_v_f_tree = 0;
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
@@ -24237,7 +26989,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
Py_CLEAR(p->__pyx_v_f_tree);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -24247,12 +26999,6 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
- if (p->__pyx_v_e_tree) {
- e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
- }
- if (p->__pyx_v_f_tree) {
- e = (*v)(p->__pyx_v_f_tree, a); if (e) return e;
- }
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
@@ -24263,14 +27009,8 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObj
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_e_tree);
- p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_f_tree);
- p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -24280,13 +27020,9 @@ static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_9_kbest_trees"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_9_kbest_trees", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/
@@ -24316,7 +27052,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24335,70 +27071,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_fmap);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+ if (p->__pyx_v_fmap) {
+ e = (*v)(((PyObject*)p->__pyx_v_fmap), a); if (e) return e;
+ }
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)o;
+ tmp = ((PyObject*)p->__pyx_v_fmap);
+ p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_5___str__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_5___str__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_10_kbest_features", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24419,95 +27163,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_methods*/
- 0, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
- #endif
-};
-
-static PyObject *__pyx_tp_new_4cdec_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- return o;
-}
-
-static void __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator(PyObject *o) {
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_16SegmentEvaluator_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
- (*Py_TYPE(o)->tp_free)(o);
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_SegmentEvaluator[] = {
- {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_16SegmentEvaluator_2evaluate)},
- {__Pyx_NAMESTR("candidate_set"), (PyCFunction)__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_16SegmentEvaluator_4candidate_set)},
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.SegmentEvaluator"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_SegmentEvaluator, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_SegmentEvaluator, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24517,7 +27179,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_SegmentEvaluator, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24526,70 +27188,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_SegmentEvaluator = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_16___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_16___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_11_unique_kbest", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24610,13 +27273,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24626,7 +27289,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24635,70 +27298,73 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_e_tree);
+ Py_CLEAR(p->__pyx_v_f_tree);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
+ Py_CLEAR(p->__pyx_v_size);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
+ if (p->__pyx_v_size) {
+ e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_size);
+ p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_20___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_20___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_12_unique_kbest_trees", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24719,13 +27385,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24735,7 +27401,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24744,8 +27410,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -24753,21 +27420,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o);
- p->__pyx_v_fmap = 0;
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
@@ -24777,7 +27439,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_fea
Py_CLEAR(p->__pyx_v_fmap);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -24800,8 +27462,8 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_fea
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o;
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features *)o;
tmp = ((PyObject*)p->__pyx_v_fmap);
p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -24814,13 +27476,9 @@ static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_featur
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_13_unique_kbest_features"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_13_unique_kbest_features", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features, /*tp_dealloc*/
@@ -24850,7 +27508,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_f
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24869,86 +27527,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_f
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_kv = 0;
- p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_kv);
- Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_kv) {
- e = (*v)(p->__pyx_v_kv, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27___init__ *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_kv);
- p->__pyx_v_kv = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_0);
- p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_28_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_28_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_14_sample", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -24969,13 +27605,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -24985,7 +27621,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -24994,86 +27630,71 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_w = 0;
- p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_w);
- Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_fmap);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_w) {
- e = (*v)(p->__pyx_v_w, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)o;
+ if (p->__pyx_v_fmap) {
+ e = (*v)(((PyObject*)p->__pyx_v_fmap), a); if (e) return e;
}
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_w);
- p->__pyx_v_w = Py_None; Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses *)o;
+ tmp = ((PyObject*)p->__pyx_v_fmap);
+ p->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_0);
- p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_3_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_15_sample_hypotheses", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25094,13 +27715,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25110,7 +27731,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25119,78 +27740,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16_sample_trees[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16_sample_trees = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16_sample_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16_sample_trees];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o);
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_16_sample_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_16_sample_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16_sample_trees(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_8_kbest[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16_sample_trees = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_8_kbest"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_16_sample_trees", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16_sample_trees), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16_sample_trees, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25211,13 +27818,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16_sample_trees, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_16_sample_trees, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25227,7 +27834,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16_sample_trees, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25236,70 +27843,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_18___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_17___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25320,13 +27921,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25336,7 +27937,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25345,78 +27946,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o);
- p->__pyx_v_self = 0;
- p->__pyx_v_trule = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_trule);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
- if (p->__pyx_v_trule) {
- e = (*v)(((PyObject*)p->__pyx_v_trule), a); if (e) return e;
- }
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Grammar *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_trule);
- p->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_7___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_18___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25437,13 +28024,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25453,7 +28040,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25462,8 +28049,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -25471,19 +28059,16 @@ static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *__pyx_freeli
static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ = 0;
static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p;
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__));
- PyObject_INIT(o, t);
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
@@ -25491,7 +28076,7 @@ static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject
struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__)))) {
__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -25508,21 +28093,17 @@ static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject
}
static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_19___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19___get__[] = {
- {0, 0, 0, 0}
-};
-
static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_19___get__"), /*tp_name*/
+ "cdec._cdec.__pyx_scope_struct_19___get__", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19___get__, /*tp_dealloc*/
@@ -25552,7 +28133,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25571,27 +28152,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) {
- PyObject *o = __pyx_tp_new_4cdec_5_cdec_Grammar(t, a, k);
- if (unlikely(!o)) return 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec_TextGrammar[] = {
- {0, 0, 0, 0}
-};
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
+}
-static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.TextGrammar"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_TextGrammar), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_20___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25610,19 +28228,15 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- #if CYTHON_COMPILING_IN_PYPY
- __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/
- #else
0, /*tp_iter*/
- #endif
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_TextGrammar, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25630,9 +28244,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_TextGrammar, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25641,70 +28255,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___get__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___get__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___get__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___get__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_21___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_21___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___get__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___get__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___get__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_25___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_21___get__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___get__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___get__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25725,13 +28333,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___get__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_21___get__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25741,7 +28349,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___get__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25750,91 +28358,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static PyObject *__pyx_tp_new_4cdec_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22___iter__ = 0;
+
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- o = (*t->tp_alloc)(t, 0);
- if (unlikely(!o)) return 0;
- p = ((struct __pyx_obj_4cdec_5_cdec_Decoder *)o);
- p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)o;
PyObject_GC_UnTrack(o);
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pw_4cdec_5_cdec_7Decoder_3__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_22___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_22___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
}
- Py_CLEAR(p->weights);
- (*Py_TYPE(o)->tp_free)(o);
}
-static int __pyx_tp_traverse_4cdec_5_cdec_Decoder(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
- if (p->weights) {
- e = (*v)(((PyObject*)p->weights), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec_Decoder(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec_Decoder *p = (struct __pyx_obj_4cdec_5_cdec_Decoder *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->weights);
- p->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_1__get__(o);
-}
-
-static int __pyx_setprop_4cdec_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
- if (v) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_7weights_3__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
-}
-
-static PyObject *__pyx_getprop_4cdec_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) {
- return __pyx_pw_4cdec_5_cdec_7Decoder_9formalism_1__get__(o);
-}
-
-static PyMethodDef __pyx_methods_4cdec_5_cdec_Decoder[] = {
- {__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Decoder_4read_weights)},
- {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_4cdec_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_7Decoder_6translate)},
- {0, 0, 0, 0}
-};
-
-static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_Decoder[] = {
- {(char *)"weights", __pyx_getprop_4cdec_5_cdec_7Decoder_weights, __pyx_setprop_4cdec_5_cdec_7Decoder_weights, 0, 0},
- {(char *)"formalism", __pyx_getprop_4cdec_5_cdec_7Decoder_formalism, 0, 0, 0},
- {0, 0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.Decoder"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec_Decoder), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_22___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec_Decoder, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25853,25 +28434,25 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec_Decoder, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec_Decoder, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec_Decoder, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
- __pyx_getsets_4cdec_5_cdec_Decoder, /*tp_getset*/
+ 0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
- __pyx_pw_4cdec_5_cdec_7Decoder_1__init__, /*tp_init*/
+ 0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec_Decoder, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25880,70 +28461,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec_Decoder = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_todot[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_todot = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_todot[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_todot];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_todot(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23_todot[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23_todot++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_todot(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_todot(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_todot = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct____iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_23_todot", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23_todot, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -25964,13 +28539,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23_todot, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23_todot, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -25980,7 +28555,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23_todot, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -25989,70 +28564,106 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24_lines[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24_lines = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24_lines[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24_lines];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24_lines(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14_sample[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14_sample++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_delta);
+ Py_CLEAR(p->__pyx_v_i);
+ Py_CLEAR(p->__pyx_v_label);
+ Py_CLEAR(p->__pyx_v_weight);
+ Py_CLEAR(p->__pyx_t_1);
+ Py_CLEAR(p->__pyx_t_3);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24_lines[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24_lines++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24_lines(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_delta) {
+ e = (*v)(p->__pyx_v_delta, a); if (e) return e;
+ }
+ if (p->__pyx_v_i) {
+ e = (*v)(p->__pyx_v_i, a); if (e) return e;
+ }
+ if (p->__pyx_v_label) {
+ e = (*v)(p->__pyx_v_label, a); if (e) return e;
+ }
+ if (p->__pyx_v_weight) {
+ e = (*v)(p->__pyx_v_weight, a); if (e) return e;
+ }
+ if (p->__pyx_t_1) {
+ e = (*v)(p->__pyx_t_1, a); if (e) return e;
+ }
+ if (p->__pyx_t_3) {
+ e = (*v)(p->__pyx_t_3, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24_lines(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23_todot *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_delta);
+ p->__pyx_v_delta = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_i);
+ p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_label);
+ p->__pyx_v_label = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_weight);
+ p->__pyx_v_weight = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_1);
+ p->__pyx_t_1 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_3);
+ p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_14_sample[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24_lines = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_14_sample"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14_sample), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_24_lines", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24_lines), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24_lines, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26073,13 +28684,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24_lines, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24_lines, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26089,7 +28700,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14_sample, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24_lines, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26098,70 +28709,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__(PyObject *o) {
PyObject* tmp;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_17___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_25___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26182,13 +28787,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26198,7 +28803,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26207,86 +28812,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26___iter__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26___iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o);
- p->__pyx_outer_scope = 0;
- p->__pyx_v_feat = 0;
- p->__pyx_t_0 = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_outer_scope);
- Py_CLEAR(p->__pyx_v_feat);
- Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o);
+ Py_CLEAR(p->__pyx_v_self);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_26___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_26___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
- if (p->__pyx_outer_scope) {
- e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
- }
- if (p->__pyx_v_feat) {
- e = (*v)(p->__pyx_v_feat, a); if (e) return e;
- }
- if (p->__pyx_t_0) {
- e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)o;
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26___iter__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)Py_None); Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_feat);
- p->__pyx_v_feat = Py_None; Py_INCREF(Py_None);
- Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_0);
- p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_26___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_6_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_26___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_26___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_26___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26307,13 +28890,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_26___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_26___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26323,7 +28906,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_26___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26332,94 +28915,106 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27__make_config[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27__make_config = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27__make_config[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27__make_config];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o);
- p->__pyx_v_e_tree = 0;
- p->__pyx_v_f_tree = 0;
- p->__pyx_v_self = 0;
- p->__pyx_v_size = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27__make_config(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_e_tree);
- Py_CLEAR(p->__pyx_v_f_tree);
- Py_CLEAR(p->__pyx_v_self);
- Py_CLEAR(p->__pyx_v_size);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o);
+ Py_CLEAR(p->__pyx_v_config);
+ Py_CLEAR(p->__pyx_v_info);
+ Py_CLEAR(p->__pyx_v_key);
+ Py_CLEAR(p->__pyx_v_name);
+ Py_CLEAR(p->__pyx_v_value);
+ Py_CLEAR(p->__pyx_t_0);
+ Py_CLEAR(p->__pyx_t_3);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_27__make_config[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_27__make_config++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27__make_config(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
- if (p->__pyx_v_e_tree) {
- e = (*v)(p->__pyx_v_e_tree, a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)o;
+ if (p->__pyx_v_config) {
+ e = (*v)(p->__pyx_v_config, a); if (e) return e;
}
- if (p->__pyx_v_f_tree) {
- e = (*v)(p->__pyx_v_f_tree, a); if (e) return e;
+ if (p->__pyx_v_info) {
+ e = (*v)(p->__pyx_v_info, a); if (e) return e;
}
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ if (p->__pyx_v_key) {
+ e = (*v)(p->__pyx_v_key, a); if (e) return e;
}
- if (p->__pyx_v_size) {
- e = (*v)(p->__pyx_v_size, a); if (e) return e;
+ if (p->__pyx_v_name) {
+ e = (*v)(p->__pyx_v_name, a); if (e) return e;
+ }
+ if (p->__pyx_v_value) {
+ e = (*v)(p->__pyx_v_value, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
+ }
+ if (p->__pyx_t_3) {
+ e = (*v)(p->__pyx_t_3, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27__make_config(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_e_tree);
- p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config *)o;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_f_tree);
- p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_info);
+ p->__pyx_v_info = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_key);
+ p->__pyx_v_key = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_v_size);
- p->__pyx_v_size = Py_None; Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_v_name);
+ p->__pyx_v_name = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_value);
+ p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_3);
+ p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_27__make_config = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_12_unique_kbest_trees"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_27__make_config", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_27__make_config), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_27__make_config, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26440,13 +29035,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_27__make_config, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_27__make_config, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26456,7 +29051,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_27__make_config, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26465,70 +29060,64 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_t
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28___init__[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28___init__ = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28___init__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28___init__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28___init__(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o);
+ Py_CLEAR(p->__pyx_v_config);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_28___init__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_28___init__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28___init__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)o;
+ if (p->__pyx_v_config) {
+ e = (*v)(p->__pyx_v_config, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28___init__(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)o;
+ tmp = ((PyObject*)p->__pyx_v_config);
+ p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_4___get__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_28___init__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_4___get__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_28___init__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_28___init__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26549,13 +29138,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_28___init__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_28___init__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26565,7 +29154,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_28___init__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26574,70 +29163,78 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[8];
-static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ = 0;
+static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_29_genexpr[8];
+static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_29_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p;
+static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__));
- PyObject_INIT(o, t);
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_29_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_29_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_29_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr));
+ (void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
o = (*t->tp_alloc)(t, 0);
if (unlikely(!o)) return 0;
}
- p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
- p->__pyx_v_self = 0;
return o;
}
-static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_29_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)o;
PyObject_GC_UnTrack(o);
- Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__))) {
- __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o);
+ Py_CLEAR(p->__pyx_outer_scope);
+ Py_CLEAR(p->__pyx_v_kv);
+ Py_CLEAR(p->__pyx_t_0);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_29_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr)))) {
+ __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_29_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_29_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
- if (p->__pyx_v_self) {
- e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)o;
+ if (p->__pyx_outer_scope) {
+ e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
+ }
+ if (p->__pyx_v_kv) {
+ e = (*v)(p->__pyx_v_kv, a); if (e) return e;
+ }
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)o;
+static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_29_genexpr(PyObject *o) {
PyObject* tmp;
- tmp = ((PyObject*)p->__pyx_v_self);
- p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)Py_None); Py_INCREF(Py_None);
+ struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr *)o;
+ tmp = ((PyObject*)p->__pyx_outer_scope);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_28___init__ *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_kv);
+ p->__pyx_v_kv = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_1___iter__[] = {
- {0, 0, 0, 0}
-};
-
-static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
+static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_29_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_1___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__), /*tp_basicsize*/
+ "cdec._cdec.__pyx_scope_struct_29_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_29_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_29_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -26658,13 +29255,13 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_29_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_29_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- __pyx_methods_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_methods*/
+ 0, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
@@ -26674,7 +29271,7 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_29_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -26683,8 +29280,9 @@ static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
#endif
};
@@ -26699,7 +29297,7 @@ static struct PyModuleDef __pyx_moduledef = {
#else
PyModuleDef_HEAD_INIT,
#endif
- __Pyx_NAMESTR("_cdec"),
+ "_cdec",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
@@ -26711,163 +29309,200 @@ static struct PyModuleDef __pyx_moduledef = {
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
- {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
- {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
- {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
- {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
- {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
- {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1},
- {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
- {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
- {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
- {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
- {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
- {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
- {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
- {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
- {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
- {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
- {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
- {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
- {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
- {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
- {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
- {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1},
- {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1},
- {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
- {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
- {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
- {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
- {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
- {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
- {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
- {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
- {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
- {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
- {&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1},
- {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
- {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
- {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
- {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
- {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
- {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
- {&__pyx_n_s__BLEU, __pyx_k__BLEU, sizeof(__pyx_k__BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__CER, __pyx_k__CER, sizeof(__pyx_k__CER), 0, 0, 1, 1},
- {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
- {&__pyx_n_s__IBM_BLEU, __pyx_k__IBM_BLEU, sizeof(__pyx_k__IBM_BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
- {&__pyx_n_s__InvalidConfig, __pyx_k__InvalidConfig, sizeof(__pyx_k__InvalidConfig), 0, 0, 1, 1},
- {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
- {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
- {&__pyx_n_s__ParseFailed, __pyx_k__ParseFailed, sizeof(__pyx_k__ParseFailed), 0, 0, 1, 1},
- {&__pyx_n_s__QCRI, __pyx_k__QCRI, sizeof(__pyx_k__QCRI), 0, 0, 1, 1},
- {&__pyx_n_s__QCRI_BLEU, __pyx_k__QCRI_BLEU, sizeof(__pyx_k__QCRI_BLEU), 0, 0, 1, 1},
- {&__pyx_n_s__SSK, __pyx_k__SSK, sizeof(__pyx_k__SSK), 0, 0, 1, 1},
- {&__pyx_n_s__TER, __pyx_k__TER, sizeof(__pyx_k__TER), 0, 0, 1, 1},
- {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
- {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
- {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
- {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1},
- {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1},
- {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1},
- {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
- {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
- {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
- {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
- {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
- {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
- {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
- {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
- {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
- {&__pyx_n_s___make_config, __pyx_k___make_config, sizeof(__pyx_k___make_config), 0, 0, 1, 1},
- {&__pyx_n_s___phrase, __pyx_k___phrase, sizeof(__pyx_k___phrase), 0, 0, 1, 1},
- {&__pyx_n_s___sa, __pyx_k___sa, sizeof(__pyx_k___sa), 0, 0, 1, 1},
- {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
- {&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1},
- {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
- {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
- {&__pyx_n_s__beam_alpha, __pyx_k__beam_alpha, sizeof(__pyx_k__beam_alpha), 0, 0, 1, 1},
- {&__pyx_n_s__cat, __pyx_k__cat, sizeof(__pyx_k__cat), 0, 0, 1, 1},
- {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
- {&__pyx_n_s__config, __pyx_k__config, sizeof(__pyx_k__config), 0, 0, 1, 1},
- {&__pyx_n_s__config_str, __pyx_k__config_str, sizeof(__pyx_k__config_str), 0, 0, 1, 1},
- {&__pyx_n_s__csplit, __pyx_k__csplit, sizeof(__pyx_k__csplit), 0, 0, 1, 1},
- {&__pyx_n_s__delta, __pyx_k__delta, sizeof(__pyx_k__delta), 0, 0, 1, 1},
- {&__pyx_n_s__density, __pyx_k__density, sizeof(__pyx_k__density), 0, 0, 1, 1},
- {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1},
- {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
- {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
- {&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 0, 0, 1, 1},
- {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
- {&__pyx_n_s__eval, __pyx_k__eval, sizeof(__pyx_k__eval), 0, 0, 1, 1},
- {&__pyx_n_s__evaluate, __pyx_k__evaluate, sizeof(__pyx_k__evaluate), 0, 0, 1, 1},
- {&__pyx_n_s__evaluator, __pyx_k__evaluator, sizeof(__pyx_k__evaluator), 0, 0, 1, 1},
- {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
- {&__pyx_n_s__formalism, __pyx_k__formalism, sizeof(__pyx_k__formalism), 0, 0, 1, 1},
- {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
- {&__pyx_n_s__fst, __pyx_k__fst, sizeof(__pyx_k__fst), 0, 0, 1, 1},
- {&__pyx_n_s__genexpr, __pyx_k__genexpr, sizeof(__pyx_k__genexpr), 0, 0, 1, 1},
- {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
- {&__pyx_n_s__grammar, __pyx_k__grammar, sizeof(__pyx_k__grammar), 0, 0, 1, 1},
- {&__pyx_n_s__hyp, __pyx_k__hyp, sizeof(__pyx_k__hyp), 0, 0, 1, 1},
- {&__pyx_n_s__hypergraph, __pyx_k__hypergraph, sizeof(__pyx_k__hypergraph), 0, 0, 1, 1},
- {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
- {&__pyx_n_s__in_edges, __pyx_k__in_edges, sizeof(__pyx_k__in_edges), 0, 0, 1, 1},
- {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
- {&__pyx_n_s__inp, __pyx_k__inp, sizeof(__pyx_k__inp), 0, 0, 1, 1},
- {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
- {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
- {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
- {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
- {&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1},
- {&__pyx_n_s__lexalign, __pyx_k__lexalign, sizeof(__pyx_k__lexalign), 0, 0, 1, 1},
- {&__pyx_n_s__lextrans, __pyx_k__lextrans, sizeof(__pyx_k__lextrans), 0, 0, 1, 1},
- {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1},
- {&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1},
- {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
- {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
- {&__pyx_n_s__pb, __pyx_k__pb, sizeof(__pyx_k__pb), 0, 0, 1, 1},
- {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1},
- {&__pyx_n_s__plf, __pyx_k__plf, sizeof(__pyx_k__plf), 0, 0, 1, 1},
- {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
- {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1},
- {&__pyx_n_s__refs, __pyx_k__refs, sizeof(__pyx_k__refs), 0, 0, 1, 1},
- {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1},
- {&__pyx_n_s__rhs, __pyx_k__rhs, sizeof(__pyx_k__rhs), 0, 0, 1, 1},
- {&__pyx_n_s__rules, __pyx_k__rules, sizeof(__pyx_k__rules), 0, 0, 1, 1},
- {&__pyx_n_s__scfg, __pyx_k__scfg, sizeof(__pyx_k__scfg), 0, 0, 1, 1},
- {&__pyx_n_s__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1},
- {&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1},
- {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
- {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
- {&__pyx_n_s__sentence, __pyx_k__sentence, sizeof(__pyx_k__sentence), 0, 0, 1, 1},
- {&__pyx_n_s__set_silent, __pyx_k__set_silent, sizeof(__pyx_k__set_silent), 0, 0, 1, 1},
- {&__pyx_n_s__span, __pyx_k__span, sizeof(__pyx_k__span), 0, 0, 1, 1},
- {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
- {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1},
- {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1},
- {&__pyx_n_s__super, __pyx_k__super, sizeof(__pyx_k__super), 0, 0, 1, 1},
- {&__pyx_n_s__tagger, __pyx_k__tagger, sizeof(__pyx_k__tagger), 0, 0, 1, 1},
- {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1},
- {&__pyx_n_s__throw, __pyx_k__throw, sizeof(__pyx_k__throw), 0, 0, 1, 1},
- {&__pyx_n_s__utf8, __pyx_k__utf8, sizeof(__pyx_k__utf8), 0, 0, 1, 1},
- {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
- {&__pyx_n_s__weight, __pyx_k__weight, sizeof(__pyx_k__weight), 0, 0, 1, 1},
- {&__pyx_n_s__yn, __pyx_k__yn, sizeof(__pyx_k__yn), 0, 0, 1, 1},
+ {&__pyx_n_s_BLEU, __pyx_k_BLEU, sizeof(__pyx_k_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_CER, __pyx_k_CER, sizeof(__pyx_k_CER), 0, 0, 1, 1},
+ {&__pyx_n_s_CandidateSet___iter, __pyx_k_CandidateSet___iter, sizeof(__pyx_k_CandidateSet___iter), 0, 0, 1, 1},
+ {&__pyx_kp_s_Cannot_translate_input_type_s, __pyx_k_Cannot_translate_input_type_s, sizeof(__pyx_k_Cannot_translate_input_type_s), 0, 0, 1, 0},
+ {&__pyx_n_s_DenseVector___iter, __pyx_k_DenseVector___iter, sizeof(__pyx_k_DenseVector___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
+ {&__pyx_n_s_Grammar___iter, __pyx_k_Grammar___iter, sizeof(__pyx_k_Grammar___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_HypergraphEdge___get, __pyx_k_HypergraphEdge___get, sizeof(__pyx_k_HypergraphEdge___get), 0, 0, 1, 1},
+ {&__pyx_n_s_HypergraphNode___get, __pyx_k_HypergraphNode___get, sizeof(__pyx_k_HypergraphNode___get), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph___get, __pyx_k_Hypergraph___get, sizeof(__pyx_k_Hypergraph___get), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest, __pyx_k_Hypergraph_kbest, sizeof(__pyx_k_Hypergraph_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest_features, __pyx_k_Hypergraph_kbest_features, sizeof(__pyx_k_Hypergraph_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_kbest_trees, __pyx_k_Hypergraph_kbest_trees, sizeof(__pyx_k_Hypergraph_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_sample, __pyx_k_Hypergraph_sample, sizeof(__pyx_k_Hypergraph_sample), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_sample_hypotheses, __pyx_k_Hypergraph_sample_hypotheses, sizeof(__pyx_k_Hypergraph_sample_hypotheses), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_sample_trees, __pyx_k_Hypergraph_sample_trees, sizeof(__pyx_k_Hypergraph_sample_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest, __pyx_k_Hypergraph_unique_kbest, sizeof(__pyx_k_Hypergraph_unique_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest_features, __pyx_k_Hypergraph_unique_kbest_features, sizeof(__pyx_k_Hypergraph_unique_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_Hypergraph_unique_kbest_trees, __pyx_k_Hypergraph_unique_kbest_trees, sizeof(__pyx_k_Hypergraph_unique_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_IBM_BLEU, __pyx_k_IBM_BLEU, sizeof(__pyx_k_IBM_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
+ {&__pyx_n_s_InvalidConfig, __pyx_k_InvalidConfig, sizeof(__pyx_k_InvalidConfig), 0, 0, 1, 1},
+ {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1},
+ {&__pyx_n_s_Lattice___iter, __pyx_k_Lattice___iter, sizeof(__pyx_k_Lattice___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
+ {&__pyx_n_s_ParseFailed, __pyx_k_ParseFailed, sizeof(__pyx_k_ParseFailed), 0, 0, 1, 1},
+ {&__pyx_n_s_QCRI, __pyx_k_QCRI, sizeof(__pyx_k_QCRI), 0, 0, 1, 1},
+ {&__pyx_n_s_QCRI_BLEU, __pyx_k_QCRI_BLEU, sizeof(__pyx_k_QCRI_BLEU), 0, 0, 1, 1},
+ {&__pyx_n_s_SSK, __pyx_k_SSK, sizeof(__pyx_k_SSK), 0, 0, 1, 1},
+ {&__pyx_n_s_SparseVector___iter, __pyx_k_SparseVector___iter, sizeof(__pyx_k_SparseVector___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_SufficientStats___iter, __pyx_k_SufficientStats___iter, sizeof(__pyx_k_SufficientStats___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_TER, __pyx_k_TER, sizeof(__pyx_k_TER), 0, 0, 1, 1},
+ {&__pyx_n_s_TRule___get, __pyx_k_TRule___get, sizeof(__pyx_k_TRule___get), 0, 0, 1, 1},
+ {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_k_Users_waziz_workspace_mtm14_my, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my), 0, 0, 1, 0},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my_2, __pyx_k_Users_waziz_workspace_mtm14_my_2, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_k_Users_waziz_workspace_mtm14_my_3, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my_3), 0, 0, 1, 0},
+ {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
+ {&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
+ {&__pyx_kp_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 0},
+ {&__pyx_kp_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 0},
+ {&__pyx_kp_s__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 0, 1, 0},
+ {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0},
+ {&__pyx_n_s__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 0, 1, 1},
+ {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
+ {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
+ {&__pyx_n_s_alignments, __pyx_k_alignments, sizeof(__pyx_k_alignments), 0, 0, 1, 1},
+ {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
+ {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
+ {&__pyx_n_s_beam_alpha, __pyx_k_beam_alpha, sizeof(__pyx_k_beam_alpha), 0, 0, 1, 1},
+ {&__pyx_kp_s_candidate_set_index_out_of_range, __pyx_k_candidate_set_index_out_of_range, sizeof(__pyx_k_candidate_set_index_out_of_range), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_create_lattice_from_s, __pyx_k_cannot_create_lattice_from_s, sizeof(__pyx_k_cannot_create_lattice_from_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_initialize_weights_with_s, __pyx_k_cannot_initialize_weights_with_s, sizeof(__pyx_k_cannot_initialize_weights_with_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_intersect_hypergraph_with, __pyx_k_cannot_intersect_hypergraph_with, sizeof(__pyx_k_cannot_intersect_hypergraph_with), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_reweight_hypergraph_with, __pyx_k_cannot_reweight_hypergraph_with, sizeof(__pyx_k_cannot_reweight_hypergraph_with), 0, 0, 1, 0},
+ {&__pyx_kp_s_cannot_take_the_dot_product_of_s, __pyx_k_cannot_take_the_dot_product_of_s, sizeof(__pyx_k_cannot_take_the_dot_product_of_s), 0, 0, 1, 0},
+ {&__pyx_n_s_cat, __pyx_k_cat, sizeof(__pyx_k_cat), 0, 0, 1, 1},
+ {&__pyx_n_s_cdec__cdec, __pyx_k_cdec__cdec, sizeof(__pyx_k_cdec__cdec), 0, 0, 1, 1},
+ {&__pyx_n_s_cdec_sa__sa, __pyx_k_cdec_sa__sa, sizeof(__pyx_k_cdec_sa__sa), 0, 0, 1, 1},
+ {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
+ {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
+ {&__pyx_kp_s_comparison_not_implemented_for_H, __pyx_k_comparison_not_implemented_for_H, sizeof(__pyx_k_comparison_not_implemented_for_H), 0, 0, 1, 0},
+ {&__pyx_kp_s_comparison_not_implemented_for_H_2, __pyx_k_comparison_not_implemented_for_H_2, sizeof(__pyx_k_comparison_not_implemented_for_H_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_comparison_not_implemented_for_S, __pyx_k_comparison_not_implemented_for_S, sizeof(__pyx_k_comparison_not_implemented_for_S), 0, 0, 1, 0},
+ {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
+ {&__pyx_n_s_config_str, __pyx_k_config_str, sizeof(__pyx_k_config_str), 0, 0, 1, 1},
+ {&__pyx_n_s_csplit, __pyx_k_csplit, sizeof(__pyx_k_csplit), 0, 0, 1, 1},
+ {&__pyx_n_s_csplit_preserve_full_word, __pyx_k_csplit_preserve_full_word, sizeof(__pyx_k_csplit_preserve_full_word), 0, 0, 1, 1},
+ {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
+ {&__pyx_kp_s_d_d_label_s, __pyx_k_d_d_label_s, sizeof(__pyx_k_d_d_label_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_d_shape_doublecircle, __pyx_k_d_shape_doublecircle, sizeof(__pyx_k_d_shape_doublecircle), 0, 0, 1, 0},
+ {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1},
+ {&__pyx_n_s_density, __pyx_k_density, sizeof(__pyx_k_density), 0, 0, 1, 1},
+ {&__pyx_kp_s_digraph_lattice, __pyx_k_digraph_lattice, sizeof(__pyx_k_digraph_lattice), 0, 0, 1, 0},
+ {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
+ {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
+ {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
+ {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
+ {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
+ {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
+ {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
+ {&__pyx_n_s_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 1, 1},
+ {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
+ {&__pyx_n_s_evaluator, __pyx_k_evaluator, sizeof(__pyx_k_evaluator), 0, 0, 1, 1},
+ {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
+ {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
+ {&__pyx_n_s_formalism, __pyx_k_formalism, sizeof(__pyx_k_formalism), 0, 0, 1, 1},
+ {&__pyx_kp_s_formalism_s_unknown, __pyx_k_formalism_s_unknown, sizeof(__pyx_k_formalism_s_unknown), 0, 0, 1, 0},
+ {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
+ {&__pyx_n_s_fst, __pyx_k_fst, sizeof(__pyx_k_fst), 0, 0, 1, 1},
+ {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
+ {&__pyx_n_s_get_2, __pyx_k_get_2, sizeof(__pyx_k_get_2), 0, 0, 1, 1},
+ {&__pyx_n_s_grammar, __pyx_k_grammar, sizeof(__pyx_k_grammar), 0, 0, 1, 1},
+ {&__pyx_n_s_hyp, __pyx_k_hyp, sizeof(__pyx_k_hyp), 0, 0, 1, 1},
+ {&__pyx_n_s_hypergraph, __pyx_k_hypergraph, sizeof(__pyx_k_hypergraph), 0, 0, 1, 1},
+ {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
+ {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
+ {&__pyx_n_s_in_edges, __pyx_k_in_edges, sizeof(__pyx_k_in_edges), 0, 0, 1, 1},
+ {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
+ {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
+ {&__pyx_n_s_init___locals_genexpr, __pyx_k_init___locals_genexpr, sizeof(__pyx_k_init___locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_inp, __pyx_k_inp, sizeof(__pyx_k_inp), 0, 0, 1, 1},
+ {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
+ {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
+ {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
+ {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest, __pyx_k_kbest, sizeof(__pyx_k_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest_features, __pyx_k_kbest_features, sizeof(__pyx_k_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_kbest_trees, __pyx_k_kbest_trees, sizeof(__pyx_k_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
+ {&__pyx_n_s_label, __pyx_k_label, sizeof(__pyx_k_label), 0, 0, 1, 1},
+ {&__pyx_kp_s_lattice_index_out_of_range, __pyx_k_lattice_index_out_of_range, sizeof(__pyx_k_lattice_index_out_of_range), 0, 0, 1, 0},
+ {&__pyx_n_s_lexalign, __pyx_k_lexalign, sizeof(__pyx_k_lexalign), 0, 0, 1, 1},
+ {&__pyx_n_s_lextrans, __pyx_k_lextrans, sizeof(__pyx_k_lextrans), 0, 0, 1, 1},
+ {&__pyx_n_s_lhs, __pyx_k_lhs, sizeof(__pyx_k_lhs), 0, 0, 1, 1},
+ {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_make_config, __pyx_k_make_config, sizeof(__pyx_k_make_config), 0, 0, 1, 1},
+ {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
+ {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
+ {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
+ {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
+ {&__pyx_kp_s_node_shape_circle, __pyx_k_node_shape_circle, sizeof(__pyx_k_node_shape_circle), 0, 0, 1, 0},
+ {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
+ {&__pyx_n_s_pb, __pyx_k_pb, sizeof(__pyx_k_pb), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase, __pyx_k_phrase, sizeof(__pyx_k_phrase), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase_2, __pyx_k_phrase_2, sizeof(__pyx_k_phrase_2), 0, 0, 1, 1},
+ {&__pyx_n_s_phrase_locals_genexpr, __pyx_k_phrase_locals_genexpr, sizeof(__pyx_k_phrase_locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_plf, __pyx_k_plf, sizeof(__pyx_k_plf), 0, 0, 1, 1},
+ {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
+ {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
+ {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
+ {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
+ {&__pyx_kp_s_rankdir_LR, __pyx_k_rankdir_LR, sizeof(__pyx_k_rankdir_LR), 0, 0, 1, 0},
+ {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
+ {&__pyx_n_s_refs, __pyx_k_refs, sizeof(__pyx_k_refs), 0, 0, 1, 1},
+ {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
+ {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1},
+ {&__pyx_n_s_rules, __pyx_k_rules, sizeof(__pyx_k_rules), 0, 0, 1, 1},
+ {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_d, __pyx_k_s_d, sizeof(__pyx_k_s_d), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_2, __pyx_k_s_s_2, sizeof(__pyx_k_s_s_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_3, __pyx_k_s_s_3, sizeof(__pyx_k_s_s_3), 0, 0, 1, 0},
+ {&__pyx_kp_s_s_s_s_s, __pyx_k_s_s_s_s, sizeof(__pyx_k_s_s_s_s), 0, 0, 1, 0},
+ {&__pyx_n_s_sa, __pyx_k_sa, sizeof(__pyx_k_sa), 0, 0, 1, 1},
+ {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1},
+ {&__pyx_n_s_sample_hypotheses, __pyx_k_sample_hypotheses, sizeof(__pyx_k_sample_hypotheses), 0, 0, 1, 1},
+ {&__pyx_n_s_sample_trees, __pyx_k_sample_trees, sizeof(__pyx_k_sample_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_scaling, __pyx_k_scaling, sizeof(__pyx_k_scaling), 0, 0, 1, 1},
+ {&__pyx_n_s_scfg, __pyx_k_scfg, sizeof(__pyx_k_scfg), 0, 0, 1, 1},
+ {&__pyx_n_s_score, __pyx_k_score, sizeof(__pyx_k_score), 0, 0, 1, 1},
+ {&__pyx_n_s_scores, __pyx_k_scores, sizeof(__pyx_k_scores), 0, 0, 1, 1},
+ {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
+ {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
+ {&__pyx_n_s_sentence, __pyx_k_sentence, sizeof(__pyx_k_sentence), 0, 0, 1, 1},
+ {&__pyx_n_s_set_silent, __pyx_k_set_silent, sizeof(__pyx_k_set_silent), 0, 0, 1, 1},
+ {&__pyx_n_s_span, __pyx_k_span, sizeof(__pyx_k_span), 0, 0, 1, 1},
+ {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
+ {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
+ {&__pyx_n_s_str___locals_genexpr, __pyx_k_str___locals_genexpr, sizeof(__pyx_k_str___locals_genexpr), 0, 0, 1, 1},
+ {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
+ {&__pyx_kp_s_sufficient_stats_vector_index_ou, __pyx_k_sufficient_stats_vector_index_ou, sizeof(__pyx_k_sufficient_stats_vector_index_ou), 0, 0, 1, 0},
+ {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
+ {&__pyx_n_s_t2s, __pyx_k_t2s, sizeof(__pyx_k_t2s), 0, 0, 1, 1},
+ {&__pyx_n_s_tagger, __pyx_k_tagger, sizeof(__pyx_k_tagger), 0, 0, 1, 1},
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
+ {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
+ {&__pyx_kp_s_the_grammar_should_contain_TRule, __pyx_k_the_grammar_should_contain_TRule, sizeof(__pyx_k_the_grammar_should_contain_TRule), 0, 0, 1, 0},
+ {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
+ {&__pyx_n_s_todot_locals_lines, __pyx_k_todot_locals_lines, sizeof(__pyx_k_todot_locals_lines), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest, __pyx_k_unique_kbest, sizeof(__pyx_k_unique_kbest), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest_features, __pyx_k_unique_kbest_features, sizeof(__pyx_k_unique_kbest_features), 0, 0, 1, 1},
+ {&__pyx_n_s_unique_kbest_trees, __pyx_k_unique_kbest_trees, sizeof(__pyx_k_unique_kbest_trees), 0, 0, 1, 1},
+ {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
+ {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
+ {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
+ {&__pyx_n_s_weights, __pyx_k_weights, sizeof(__pyx_k_weights), 0, 0, 1, 1},
+ {&__pyx_n_s_yn, __pyx_k_yn, sizeof(__pyx_k_yn), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_eval = __Pyx_GetBuiltinName(__pyx_n_s__eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_eval = __Pyx_GetBuiltinName(__pyx_n_s_eval); if (!__pyx_builtin_eval) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -26884,225 +29519,225 @@ static int __Pyx_InitCachedConstants(void) {
* elif isinstance(data, str):
* ret = data
*/
- __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_2);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+ __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple_);
+ __Pyx_GIVEREF(__pyx_tuple_);
- /* "/usr0/home/austinma/git/cdec/python/cdec/vectors.pxi":95
+ /* "cdec/vectors.pxi":95
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
- __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_5);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_S); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__2);
+ __Pyx_GIVEREF(__pyx_tuple__2);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":6
+ /* "cdec/grammar.pxi":6
*
* def _phrase(phrase):
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<<
*
* cdef class NT:
*/
- __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_6);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__3);
+ __Pyx_GIVEREF(__pyx_tuple__3);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":232
+ /* "cdec/grammar.pxi":232
* trule = convert_rule(trule)
* elif not isinstance(trule, TRule):
* raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<<
* _g.AddRule((<TRule> trule).rule[0])
*/
- __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_14);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_the_grammar_should_contain_TRule); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__5);
+ __Pyx_GIVEREF(__pyx_tuple__5);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":292
+ /* "cdec/hypergraph.pxi":307
* elif op == 3: # !=
* return not (x == y)
* raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<<
*
* cdef class HypergraphNode:
*/
- __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_19);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
+ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_H); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__6);
+ __Pyx_GIVEREF(__pyx_tuple__6);
- /* "/usr0/home/austinma/git/cdec/python/cdec/hypergraph.pxi":333
+ /* "cdec/hypergraph.pxi":348
* 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 = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_21);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
+ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_comparison_not_implemented_for_H_2); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__7);
+ __Pyx_GIVEREF(__pyx_tuple__7);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":26
+ /* "cdec/lattice.pxi":26
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* arcs = []
* cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index]
*/
- __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_24);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
+ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_lattice_index_out_of_range); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__8);
+ __Pyx_GIVEREF(__pyx_tuple__8);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":39
+ /* "cdec/lattice.pxi":39
* def __setitem__(self, int index, tuple arcs):
* if not 0 <= index < len(self):
* raise IndexError('lattice index out of range') # <<<<<<<<<<<<<<
* cdef lattice.LatticeArc* arc
* for (label, cost, dist2next) in arcs:
*/
- __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_23)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_25);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
+ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_lattice_index_out_of_range); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__9);
+ __Pyx_GIVEREF(__pyx_tuple__9);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":69
+ /* "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('"', '\\"')) # <<<<<<<<<<<<<<
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
*/
- __pyx_k_tuple_32 = PyTuple_Pack(2, ((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_32);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
+ __pyx_tuple__12 = PyTuple_Pack(2, __pyx_kp_s__10, __pyx_kp_s__11); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__12);
+ __Pyx_GIVEREF(__pyx_tuple__12);
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":63
+ /* "cdec/lattice.pxi":63
* def todot(self):
* """lattice.todot() -> Representation of the lattice in GraphViz dot format."""
* def lines(): # <<<<<<<<<<<<<<
* yield 'digraph lattice {'
* yield 'rankdir = LR;'
*/
- __pyx_k_tuple_35 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_n_s__weight), ((PyObject *)__pyx_n_s__delta)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_35);
- __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;}
+ __pyx_tuple__14 = PyTuple_Pack(4, __pyx_n_s_i, __pyx_n_s_label, __pyx_n_s_weight, __pyx_n_s_delta); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__14);
+ __Pyx_GIVEREF(__pyx_tuple__14);
+ __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/lattice.pxi":72
+ /* "cdec/lattice.pxi":72
* yield '%d [shape=doublecircle]' % len(self)
* yield '}'
* return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<<
*
* def as_hypergraph(self):
*/
- __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_41);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__17);
+ __Pyx_GIVEREF(__pyx_tuple__17);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":50
+ /* "cdec/mteval.pxi":53
* def __getitem__(self, int index):
* if not 0 <= index < len(self):
* raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<<
* return self.stats[0][index]
*
*/
- __pyx_k_tuple_43 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_42)); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_43);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
+ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_sufficient_stats_vector_index_ou); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__18);
+ __Pyx_GIVEREF(__pyx_tuple__18);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":84
+ /* "cdec/mteval.pxi":87
* def __getitem__(self,int k):
* if not 0 <= k < self.cs.size():
* raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<<
* cdef Candidate candidate = Candidate()
* candidate.candidate = &self.cs[0][k]
*/
- __pyx_k_tuple_45 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_44)); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_45);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
+ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_candidate_set_index_out_of_range); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__19);
+ __Pyx_GIVEREF(__pyx_tuple__19);
/* "cdec/_cdec.pyx":92
* with open(weights) as fp:
* for line in fp:
* if line.strip().startswith('#'): continue # <<<<<<<<<<<<<<
* fname, value = line.split()
- * self.weights[fname.strip()] = float(value)
+ * self.weights[fname.strip()] = float(value) * scaling
*/
- __pyx_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_51);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));
+ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s__20); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__21);
+ __Pyx_GIVEREF(__pyx_tuple__21);
/* "cdec/_cdec.pyx":90
- * def read_weights(self, weights):
+ * def read_weights(self, weights, scaling = 1.0):
* """decoder.read_weights(filename): Read decoder weights from a file."""
* with open(weights) as fp: # <<<<<<<<<<<<<<
* for line in fp:
* if line.strip().startswith('#'): continue
*/
- __pyx_k_tuple_52 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_52);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));
+ __pyx_tuple__22 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__22);
+ __Pyx_GIVEREF(__pyx_tuple__22);
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
+ /* "cdec/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
*/
- __pyx_k_tuple_56 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_56);
- __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;}
+ __pyx_tuple__24 = PyTuple_Pack(3, __pyx_n_s_phrase_2, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__24);
+ __Pyx_GIVEREF(__pyx_tuple__24);
+ __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_2, __pyx_n_s_phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":194
+ /* "cdec/mteval.pxi":197
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
*/
- __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__IBM_BLEU)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_59);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));
+ __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_IBM_BLEU); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__26);
+ __Pyx_GIVEREF(__pyx_tuple__26);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":195
+ /* "cdec/mteval.pxi":198
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__QCRI_BLEU)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_60);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
+ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_QCRI_BLEU); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__27);
+ __Pyx_GIVEREF(__pyx_tuple__27);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":196
+ /* "cdec/mteval.pxi":199
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
* SSK = Scorer('SSK')
*/
- __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__TER)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_61);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
+ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_TER); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__28);
+ __Pyx_GIVEREF(__pyx_tuple__28);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":197
+ /* "cdec/mteval.pxi":200
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
* SSK = Scorer('SSK')
*/
- __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__CER)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_62);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
+ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_CER); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__29);
+ __Pyx_GIVEREF(__pyx_tuple__29);
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":198
+ /* "cdec/mteval.pxi":201
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
*/
- __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SSK)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_63);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
+ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_SSK); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__30);
+ __Pyx_GIVEREF(__pyx_tuple__30);
/* "cdec/_cdec.pyx":28
* class ParseFailed(Exception): pass
@@ -27111,10 +29746,10 @@ static int __Pyx_InitCachedConstants(void) {
* """set_silent(bool): Configure the verbosity of cdec."""
* SetSilent(yn)
*/
- __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__yn)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_64);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));
- __pyx_k_codeobj_65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_66, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_yn); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__31);
+ __Pyx_GIVEREF(__pyx_tuple__31);
+ __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/_cdec.pyx":32
* SetSilent(yn)
@@ -27123,10 +29758,10 @@ static int __Pyx_InitCachedConstants(void) {
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_k_tuple_67 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__config), ((PyObject *)__pyx_n_s__key), ((PyObject *)__pyx_n_s__value), ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_n_s__info)); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_k_tuple_67);
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
- __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_66, __pyx_n_s___make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_config, __pyx_n_s_key, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_info); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_tuple__33);
+ __Pyx_GIVEREF(__pyx_tuple__33);
+ __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -27136,8 +29771,9 @@ static int __Pyx_InitCachedConstants(void) {
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -27155,6 +29791,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -27190,34 +29827,34 @@ PyMODINIT_FUNC PyInit__cdec(void)
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
- __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_cdec"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ __pyx_m = Py_InitModule4("_cdec", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_d);
- #if PY_MAJOR_VERSION >= 3
- {
- PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (!PyDict_GetItemString(modules, "cdec._cdec")) {
- if (unlikely(PyDict_SetItemString(modules, "cdec._cdec", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- }
- #endif
- __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
- if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if (__pyx_module_is_main_cdec___cdec) {
- if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ }
+ #if PY_MAJOR_VERSION >= 3
+ {
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!PyDict_GetItemString(modules, "cdec._cdec")) {
+ if (unlikely(PyDict_SetItemString(modules, "cdec._cdec", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
}
+ #endif
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
@@ -27226,39 +29863,11 @@ PyMODINIT_FUNC PyInit__cdec(void)
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__.doc = __pyx_doc_4cdec_5_cdec_5TRule___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5TRule___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_TRule = &__pyx_type_4cdec_5_cdec_TRule;
- __pyx_type_4cdec_5_cdec_MRule.tp_base = __pyx_ptype_4cdec_5_cdec_TRule;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if CYTHON_COMPILING_IN_CPYTHON
- {
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__.doc = __pyx_doc_4cdec_5_cdec_5MRule___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5MRule___init__;
- }
- }
- #endif
- if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_MRule = &__pyx_type_4cdec_5_cdec_MRule;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_DenseVector.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_11DenseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_11DenseVector___init__.doc = __pyx_doc_4cdec_5_cdec_11DenseVector___init__;
@@ -27266,29 +29875,13 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "DenseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_DenseVector = &__pyx_type_4cdec_5_cdec_DenseVector;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_SufficientStats = &__pyx_type_4cdec_5_cdec_SufficientStats;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_lines = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_lines;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27___init__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_27___init__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___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_21___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Metric = &__pyx_type_4cdec_5_cdec_Metric;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Candidate = &__pyx_type_4cdec_5_cdec_Candidate;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SparseVector.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_12SparseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_12SparseVector___init__.doc = __pyx_doc_4cdec_5_cdec_12SparseVector___init__;
@@ -27296,14 +29889,13 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_4cdec_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_SparseVector = &__pyx_type_4cdec_5_cdec_SparseVector;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26__make_config = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_26__make_config;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_NT.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_2NT___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_2NT___init__.doc = __pyx_doc_4cdec_5_cdec_2NT___init__;
@@ -27311,99 +29903,61 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_4cdec_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_NT = &__pyx_type_4cdec_5_cdec_NT;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_NTRef.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NTRef, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__.doc = __pyx_doc_4cdec_5_cdec_7Lattice_2__init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__;
+ __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__.doc = __pyx_doc_4cdec_5_cdec_5NTRef___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Lattice = &__pyx_type_4cdec_5_cdec_Lattice;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_trees;
- __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge = &__pyx_vtable_4cdec_5_cdec_HypergraphEdge;
- __pyx_vtable_4cdec_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphEdge_init;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_HypergraphEdge = &__pyx_type_4cdec_5_cdec_HypergraphEdge;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Scorer = &__pyx_type_4cdec_5_cdec_Scorer;
- __pyx_vtabptr_4cdec_5_cdec_HypergraphNode = &__pyx_vtable_4cdec_5_cdec_HypergraphNode;
- __pyx_vtable_4cdec_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphNode_init;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_HypergraphNode = &__pyx_type_4cdec_5_cdec_HypergraphNode;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_NTRef = &__pyx_type_4cdec_5_cdec_NTRef;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_TRule.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_NTRef, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
- __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
- __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__.doc = __pyx_doc_4cdec_5_cdec_5NTRef___init__;
- ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__;
+ __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__.doc = __pyx_doc_4cdec_5_cdec_5TRule___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5TRule___init__;
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "NTRef", (PyObject *)&__pyx_type_4cdec_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_NTRef = &__pyx_type_4cdec_5_cdec_NTRef;
+ if (PyObject_SetAttrString(__pyx_m, "TRule", (PyObject *)&__pyx_type_4cdec_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_TRule = &__pyx_type_4cdec_5_cdec_TRule;
+ __pyx_type_4cdec_5_cdec_MRule.tp_base = __pyx_ptype_4cdec_5_cdec_TRule;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_MRule.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__.doc = __pyx_doc_4cdec_5_cdec_5MRule___init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_5MRule___init__;
+ }
+ }
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_MRule = &__pyx_type_4cdec_5_cdec_MRule;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Grammar.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_4cdec_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_Grammar = &__pyx_type_4cdec_5_cdec_Grammar;
- __pyx_vtabptr_4cdec_5_cdec_Hypergraph = &__pyx_vtable_4cdec_5_cdec_Hypergraph;
- __pyx_vtable_4cdec_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *))__pyx_f_4cdec_5_cdec_10Hypergraph__rng;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_Hypergraph = &__pyx_type_4cdec_5_cdec_Hypergraph;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec_CandidateSet = &__pyx_type_4cdec_5_cdec_CandidateSet;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22_todot = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_22_todot;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__;
- 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 = 209; __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_20___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_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_28_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_28_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__;
__pyx_type_4cdec_5_cdec_TextGrammar.tp_base = __pyx_ptype_4cdec_5_cdec_Grammar;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_TextGrammar.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__.doc = __pyx_doc_4cdec_5_cdec_11TextGrammar___init__;
@@ -27411,14 +29965,72 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_5_cdec_TextGrammar = &__pyx_type_4cdec_5_cdec_TextGrammar;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__;
+ __pyx_vtabptr_4cdec_5_cdec_Hypergraph = &__pyx_vtable_4cdec_5_cdec_Hypergraph;
+ __pyx_vtable_4cdec_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *))__pyx_f_4cdec_5_cdec_10Hypergraph__rng;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Hypergraph.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_4cdec_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Hypergraph = &__pyx_type_4cdec_5_cdec_Hypergraph;
+ __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge = &__pyx_vtable_4cdec_5_cdec_HypergraphEdge;
+ __pyx_vtable_4cdec_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphEdge_init;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_HypergraphEdge.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_HypergraphEdge = &__pyx_type_4cdec_5_cdec_HypergraphEdge;
+ __pyx_vtabptr_4cdec_5_cdec_HypergraphNode = &__pyx_vtable_4cdec_5_cdec_HypergraphNode;
+ __pyx_vtable_4cdec_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_4cdec_5_cdec_14HypergraphNode_init;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_HypergraphNode.tp_print = 0;
+ if (__Pyx_SetVtable(__pyx_type_4cdec_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_4cdec_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_HypergraphNode = &__pyx_type_4cdec_5_cdec_HypergraphNode;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Lattice.tp_print = 0;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ {
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
+ __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
+ __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__.doc = __pyx_doc_4cdec_5_cdec_7Lattice_2__init__;
+ ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__;
+ }
+ }
+ #endif
+ if (PyObject_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_4cdec_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Lattice = &__pyx_type_4cdec_5_cdec_Lattice;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Candidate.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_4cdec_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Candidate = &__pyx_type_4cdec_5_cdec_Candidate;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SufficientStats.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_4cdec_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_SufficientStats = &__pyx_type_4cdec_5_cdec_SufficientStats;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_CandidateSet.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "CandidateSet", (PyObject *)&__pyx_type_4cdec_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_CandidateSet = &__pyx_type_4cdec_5_cdec_CandidateSet;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_SegmentEvaluator.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "SegmentEvaluator", (PyObject *)&__pyx_type_4cdec_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 103; __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_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Scorer.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_4cdec_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Scorer = &__pyx_type_4cdec_5_cdec_Scorer;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Metric.tp_print = 0;
+ if (PyObject_SetAttrString(__pyx_m, "Metric", (PyObject *)&__pyx_type_4cdec_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_5_cdec_Metric = &__pyx_type_4cdec_5_cdec_Metric;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec_Decoder.tp_print = 0;
#if CYTHON_COMPILING_IN_CPYTHON
{
- PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
__pyx_wrapperbase_4cdec_5_cdec_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
__pyx_wrapperbase_4cdec_5_cdec_7Decoder___init__.doc = __pyx_doc_4cdec_5_cdec_7Decoder___init__;
@@ -27426,31 +30038,107 @@ PyMODINIT_FUNC PyInit__cdec(void)
}
}
#endif
- if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_4cdec_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__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_type_4cdec_5_cdec___pyx_scope_struct____iter__.tp_print = 0;
__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_14_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 215; __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_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr.tp_print = 0;
__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_unique_kbest;
if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees.tp_print = 0;
__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_12_unique_kbest_trees;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__;
- if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_13_unique_kbest_features;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14_sample = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_14_sample;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_15_sample_hypotheses;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_16_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_16_sample_trees.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16_sample_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_16_sample_trees;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__.tp_print = 0;
+ __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___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_19___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_20___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___get__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_21___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_21___get__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_22___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_23_todot.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23_todot = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_23_todot;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_24_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_24_lines.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24_lines = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_24_lines;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_26___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_26___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_26___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_26___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_27__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_27__make_config.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_27__make_config = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_27__make_config;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_28___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_28___init__.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_28___init__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_28___init__;
+ if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_5_cdec___pyx_scope_struct_29_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_29_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_29_genexpr;
/*--- Type import code ---*/
- __pyx_ptype_4cdec_2sa_3_sa_FloatList = __Pyx_ImportType("cdec.sa._sa", "FloatList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_FloatList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_IntList = __Pyx_ImportType("cdec.sa._sa", "IntList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_IntList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = __Pyx_ImportType("cdec.sa._sa", "FeatureVector", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FloatList = __Pyx_ImportType("cdec.sa._sa", "FloatList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_FloatList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_FloatList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_IntList = __Pyx_ImportType("cdec.sa._sa", "IntList", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_IntList = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_IntList)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = __Pyx_ImportType("cdec.sa._sa", "FeatureVector", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Phrase = __Pyx_ImportType("cdec.sa._sa", "Phrase", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_vtabptr_4cdec_2sa_3_sa_Phrase = (struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase*)__Pyx_GetVtable(__pyx_ptype_4cdec_2sa_3_sa_Phrase->tp_dict); if (unlikely(!__pyx_vtabptr_4cdec_2sa_3_sa_Phrase)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_ptype_4cdec_2sa_3_sa_Rule = __Pyx_ImportType("cdec.sa._sa", "Rule", sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), 1); if (unlikely(!__pyx_ptype_4cdec_2sa_3_sa_Rule)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Variable import code ---*/
/*--- Function import code ---*/
__pyx_t_1 = __Pyx_ImportModule("cdec.sa._sa"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -27461,7 +30149,7 @@ PyMODINIT_FUNC PyInit__cdec(void)
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*--- Execution code ---*/
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":3
+ /* "cdec/grammar.pxi":3
* cimport grammar
* cimport cdec.sa._sa as _sa
* import cdec.sa._sa as _sa # <<<<<<<<<<<<<<
@@ -27470,82 +30158,82 @@ PyMODINIT_FUNC PyInit__cdec(void)
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_n_s_55));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_55));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s_55));
- __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_54), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_n_s__23);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__23);
+ __Pyx_GIVEREF(__pyx_n_s__23);
+ __pyx_t_3 = __Pyx_Import(__pyx_n_s_cdec_sa__sa, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- 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_2); __pyx_t_2 = 0;
+ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/grammar.pxi":5
+ /* "cdec/grammar.pxi":5
* import cdec.sa._sa as _sa
*
* def _phrase(phrase): # <<<<<<<<<<<<<<
* return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase)
*
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_1_phrase, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_1_phrase, NULL, __pyx_n_s_cdec__cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ 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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":194
+ /* "cdec/mteval.pxi":197
* return []
*
* BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<<
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEU, __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;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":195
+ /* "cdec/mteval.pxi":198
*
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<<
* TER = Scorer('TER')
* CER = Scorer('CER')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_QCRI, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":196
+ /* "cdec/mteval.pxi":199
* BLEU = Scorer('IBM_BLEU')
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER') # <<<<<<<<<<<<<<
* CER = Scorer('CER')
* SSK = Scorer('SSK')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_TER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":197
+ /* "cdec/mteval.pxi":200
* QCRI = Scorer('QCRI_BLEU')
* TER = Scorer('TER')
* CER = Scorer('CER') # <<<<<<<<<<<<<<
* SSK = Scorer('SSK')
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- 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;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_CER, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/austinma/git/cdec/python/cdec/mteval.pxi":198
+ /* "cdec/mteval.pxi":201
* TER = Scorer('TER')
* CER = Scorer('CER')
* SSK = Scorer('SSK') # <<<<<<<<<<<<<<
*/
- __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_Scorer)), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SSK, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":22
@@ -27573,19 +30261,22 @@ PyMODINIT_FUNC PyInit__cdec(void)
* class ParseFailed(Exception): pass
*
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_builtin_Exception);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
__Pyx_GIVEREF(__pyx_builtin_Exception);
- __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__InvalidConfig, __pyx_n_s__InvalidConfig, __pyx_n_s_39); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_InvalidConfig, __pyx_n_s_InvalidConfig, (PyObject *) NULL, __pyx_n_s_cdec__cdec, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__InvalidConfig, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_InvalidConfig, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_InvalidConfig, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":26
*
@@ -27594,19 +30285,22 @@ PyMODINIT_FUNC PyInit__cdec(void)
*
* def set_silent(yn):
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_builtin_Exception);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
__Pyx_GIVEREF(__pyx_builtin_Exception);
- __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__ParseFailed, __pyx_n_s__ParseFailed, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__ParseFailed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_ParseFailed, __pyx_n_s_ParseFailed, (PyObject *) NULL, __pyx_n_s_cdec__cdec, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ParseFailed, __pyx_t_3, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_ParseFailed, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":28
* class ParseFailed(Exception): pass
@@ -27615,9 +30309,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* """set_silent(bool): Configure the verbosity of cdec."""
* SetSilent(yn)
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_3set_silent, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_3set_silent, NULL, __pyx_n_s_cdec__cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s__set_silent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_silent, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":32
@@ -27627,9 +30321,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* for key, value in config.items():
* if isinstance(value, dict):
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_5_make_config, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_5_cdec_5_make_config, NULL, __pyx_n_s_cdec__cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s___make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_config, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "cdec/_cdec.pyx":1
@@ -27638,9 +30332,9 @@ PyMODINIT_FUNC PyInit__cdec(void)
* from utils cimport *
*/
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "string.from_py":13
*
@@ -27649,14 +30343,21 @@ PyMODINIT_FUNC PyInit__cdec(void)
* cdef Py_ssize_t length
* cdef char* data = __Pyx_PyObject_AsStringAndSize(o, &length)
*/
+
+ /*--- Wrapped vars code ---*/
+
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
if (__pyx_m) {
- __Pyx_AddTraceback("init cdec._cdec", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init cdec._cdec", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ Py_DECREF(__pyx_d); __pyx_d = 0;
+ }
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init cdec._cdec");
@@ -27685,7 +30386,7 @@ end:
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
-#endif /* CYTHON_REFNANNY */
+#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
@@ -27694,12 +30395,80 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
#if PY_MAJOR_VERSION >= 3
"name '%U' is not defined", name);
#else
- "name '%s' is not defined", PyString_AS_STRING(name));
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
}
return result;
}
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
+ PyObject *result;
+ ternaryfunc call = func->ob_type->tp_call;
+ if (unlikely(!call))
+ return PyObject_Call(func, arg, kw);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = (*call)(func, arg, kw);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
+#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
@@ -27749,11 +30518,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
}
- #if PY_VERSION_HEX < 0x02050000
- if (PyClass_Check(type)) {
- #else
if (PyType_Check(type)) {
- #endif
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
@@ -27768,17 +30533,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
value = type;
- #if PY_VERSION_HEX < 0x02050000
- if (PyInstance_Check(type)) {
- type = (PyObject*) ((PyInstanceObject*)type)->in_class;
- Py_INCREF(type);
- } else {
- type = 0;
- PyErr_SetString(PyExc_TypeError,
- "raise: exception must be an old-style class or instance");
- goto raise_error;
- }
- #else
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
@@ -27786,7 +30540,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
- #endif
}
__Pyx_ErrRestore(type, value, tb);
return;
@@ -27796,7 +30549,7 @@ raise_error:
Py_XDECREF(tb);
return;
}
-#else /* Python 3+ */
+#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
@@ -27817,27 +30570,40 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
- PyObject *args;
- if (!value)
- args = PyTuple_New(0);
- else if (PyTuple_Check(value)) {
- Py_INCREF(value);
- args = value;
- } else
- args = PyTuple_Pack(1, value);
- if (!args)
- goto bad;
- owned_instance = PyEval_CallObject(type, args);
- Py_DECREF(args);
- if (!owned_instance)
- goto bad;
- value = owned_instance;
- if (!PyExceptionInstance_Check(value)) {
- PyErr_Format(PyExc_TypeError,
- "calling %R should have returned an instance of "
- "BaseException, not %R",
- type, Py_TYPE(value));
- goto bad;
+ PyObject *instance_class = NULL;
+ if (value && PyExceptionInstance_Check(value)) {
+ instance_class = (PyObject*) Py_TYPE(value);
+ if (instance_class != type) {
+ if (PyObject_IsSubclass(instance_class, type)) {
+ type = instance_class;
+ } else {
+ instance_class = NULL;
+ }
+ }
+ }
+ if (!instance_class) {
+ PyObject *args;
+ if (!value)
+ args = PyTuple_New(0);
+ else if (PyTuple_Check(value)) {
+ Py_INCREF(value);
+ args = value;
+ } else
+ args = PyTuple_Pack(1, value);
+ if (!args)
+ goto bad;
+ owned_instance = PyObject_Call(type, args, NULL);
+ Py_DECREF(args);
+ if (!owned_instance)
+ goto bad;
+ value = owned_instance;
+ if (!PyExceptionInstance_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "calling %R should have returned an instance of "
+ "BaseException, not %R",
+ type, Py_TYPE(value));
+ goto bad;
+ }
}
} else {
PyErr_SetString(PyExc_TypeError,
@@ -27903,7 +30669,7 @@ static void __Pyx_RaiseArgtupleInvalid(
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
- "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
+ "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
@@ -27915,7 +30681,7 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
{
PyObject* key = 0;
Py_ssize_t pos = 0;
-#if CPYTHON_COMPILING_IN_PYPY
+#if CYTHON_COMPILING_IN_PYPY
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
goto invalid_keyword;
return 1;
@@ -27932,13 +30698,13 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
return 1;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
- "%s() keywords must be strings", function_name);
+ "%.200s() keywords must be strings", function_name);
return 0;
#endif
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "%s() got an unexpected keyword argument '%s'",
+ "%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
@@ -27947,29 +30713,35 @@ invalid_keyword:
return 0;
}
-static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
+ PyErr_Format(PyExc_TypeError,
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
+}
+static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
- if (!type) {
- PyErr_Format(PyExc_SystemError, "Missing type object");
+ if (unlikely(!type)) {
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
- if (Py_TYPE(obj) == type) return 1;
+ if (likely(Py_TYPE(obj) == type)) return 1;
+ #if PY_MAJOR_VERSION == 2
+ else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
+ #endif
}
else {
- if (PyObject_TypeCheck(obj, type)) return 1;
+ if (likely(PyObject_TypeCheck(obj, type))) return 1;
}
- PyErr_Format(PyExc_TypeError,
- "Argument '%s' has incorrect type (expected %s, got %s)",
- name, type->tp_name, Py_TYPE(obj)->tp_name);
+ __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
return 0;
}
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
- PyErr_Format(PyExc_SystemError, "Missing type object");
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
@@ -27979,10 +30751,123 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
return 0;
}
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *local_type, *local_value, *local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ local_type = tstate->curexc_type;
+ local_value = tstate->curexc_value;
+ local_tb = tstate->curexc_traceback;
+ tstate->curexc_type = 0;
+ tstate->curexc_value = 0;
+ tstate->curexc_traceback = 0;
+#else
+ PyErr_Fetch(&local_type, &local_value, &local_tb);
+#endif
+ PyErr_NormalizeException(&local_type, &local_value, &local_tb);
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (unlikely(tstate->curexc_type))
+#else
+ if (unlikely(PyErr_Occurred()))
+#endif
+ goto bad;
+ #if PY_MAJOR_VERSION >= 3
+ if (local_tb) {
+ if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
+ goto bad;
+ }
+ #endif
+ Py_XINCREF(local_tb);
+ Py_XINCREF(local_type);
+ Py_XINCREF(local_value);
+ *type = local_type;
+ *value = local_value;
+ *tb = local_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = local_type;
+ tstate->exc_value = local_value;
+ tstate->exc_traceback = local_tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(local_type, local_value, local_tb);
+#endif
+ return 0;
+bad:
+ *type = 0;
+ *value = 0;
+ *tb = 0;
+ Py_XDECREF(local_type);
+ Py_XDECREF(local_value);
+ Py_XDECREF(local_tb);
+ return -1;
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = *type;
+ tstate->exc_value = *value;
+ tstate->exc_traceback = *tb;
+#else
+ PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
+ PyErr_SetExcInfo(*type, *value, *tb);
+#endif
+ *type = tmp_type;
+ *value = tmp_value;
+ *tb = tmp_tb;
+}
+
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyThreadState *tstate = PyThreadState_GET();
+ *type = tstate->exc_type;
+ *value = tstate->exc_value;
+ *tb = tstate->exc_traceback;
+ Py_XINCREF(*type);
+ Py_XINCREF(*value);
+ Py_XINCREF(*tb);
+#else
+ PyErr_GetExcInfo(type, value, tb);
+#endif
+}
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
+ PyThreadState *tstate = PyThreadState_GET();
+ tmp_type = tstate->exc_type;
+ tmp_value = tstate->exc_value;
+ tmp_tb = tstate->exc_traceback;
+ tstate->exc_type = type;
+ tstate->exc_value = value;
+ tstate->exc_traceback = tb;
+ Py_XDECREF(tmp_type);
+ Py_XDECREF(tmp_value);
+ Py_XDECREF(tmp_tb);
+#else
+ PyErr_SetExcInfo(type, value, tb);
+#endif
+}
+
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}
+#if !CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
+ return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
+}
+#endif
+
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
@@ -28082,12 +30967,12 @@ arg_passed_twice:
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
- "%s() keywords must be strings", function_name);
+ "%.200s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
- "%s() got an unexpected keyword argument '%s'",
+ "%.200s() got an unexpected keyword argument '%.200s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
@@ -28097,14 +30982,62 @@ bad:
return -1;
}
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
+ PyObject *method, *result = NULL;
+ method = __Pyx_PyObject_GetAttrStr(obj, method_name);
+ if (unlikely(!method)) goto bad;
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyMethod_Check(method))) {
+ PyObject *self = PyMethod_GET_SELF(method);
+ if (likely(self)) {
+ PyObject *args;
+ PyObject *function = PyMethod_GET_FUNCTION(method);
+ args = PyTuple_New(2);
+ if (unlikely(!args)) goto bad;
+ Py_INCREF(self);
+ PyTuple_SET_ITEM(args, 0, self);
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 1, arg);
+ Py_INCREF(function);
+ Py_DECREF(method); method = NULL;
+ result = __Pyx_PyObject_Call(function, args, NULL);
+ Py_DECREF(args);
+ Py_DECREF(function);
+ return result;
+ }
+ }
+#endif
+ result = __Pyx_PyObject_CallOneArg(method, arg);
+bad:
+ Py_XDECREF(method);
+ return result;
+}
+
+static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
- if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return NULL;
- Py_INCREF(Py_None);
- return Py_None; /* this is just to have an accurate signature */
+ if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
} else {
- return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x);
+ PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
+ if (unlikely(!retval))
+ return -1;
+ Py_DECREF(retval);
}
+ return 0;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
@@ -28192,7 +31125,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
- "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
+ "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
index, (index == 1) ? "" : "s");
}
@@ -28245,7 +31178,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
result = PyDict_GetItem(__pyx_d, name);
- if (result) {
+ if (likely(result)) {
Py_INCREF(result);
} else {
#else
@@ -28259,10 +31192,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
}
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
- CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
+ CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
+ int full_traceback) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
+ if (full_traceback) {
+ Py_XINCREF(old_exc);
+ Py_XINCREF(old_val);
+ Py_XINCREF(old_tb);
+ __Pyx_ErrRestore(old_exc, old_val, old_tb);
+ PyErr_PrintEx(1);
+ }
#if PY_MAJOR_VERSION < 3
ctx = PyString_FromString(name);
#else
@@ -28293,7 +31234,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
if (likely(next))
return next;
#if CYTHON_COMPILING_IN_CPYTHON
-#if PY_VERSION_HEX >= 0x03010000 || (PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
+#if PY_VERSION_HEX >= 0x02070000
if (unlikely(iternext == &_PyObject_NextNotImplemented))
return NULL;
#endif
@@ -28314,6 +31255,44 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
return NULL;
}
+static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
+ PyObject* fake_module;
+ PyTypeObject* cached_type = NULL;
+ fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
+ if (!fake_module) return NULL;
+ Py_INCREF(fake_module);
+ cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
+ if (cached_type) {
+ if (!PyType_Check((PyObject*)cached_type)) {
+ PyErr_Format(PyExc_TypeError,
+ "Shared Cython type %.200s is not a type object",
+ type->tp_name);
+ goto bad;
+ }
+ if (cached_type->tp_basicsize != type->tp_basicsize) {
+ PyErr_Format(PyExc_TypeError,
+ "Shared Cython type %.200s has the wrong size, try recompiling",
+ type->tp_name);
+ goto bad;
+ }
+ } else {
+ if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
+ PyErr_Clear();
+ if (PyType_Ready(type) < 0) goto bad;
+ if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
+ goto bad;
+ Py_INCREF(type);
+ cached_type = type;
+ }
+done:
+ Py_DECREF(fake_module);
+ return cached_type;
+bad:
+ Py_XDECREF(cached_type);
+ cached_type = NULL;
+ goto done;
+}
+
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
@@ -28338,8 +31317,9 @@ static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
- if (value == NULL)
- value = Py_None; /* Mark as deleted */
+ if (value == NULL) {
+ value = Py_None;
+ }
Py_INCREF(value);
op->func_doc = value;
Py_XDECREF(tmp);
@@ -28446,11 +31426,10 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
return 0;
}
static PyObject *
-__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
+__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
- PyObject* dict = PyModule_GetDict(__pyx_m);
- Py_XINCREF(dict);
- return dict;
+ Py_INCREF(op->func_globals);
+ return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
@@ -28585,7 +31564,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
{0, 0, 0, 0, 0}
};
-#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
+#ifndef PY_WRITE_RESTRICTED
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
@@ -28602,16 +31581,21 @@ __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
- {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
+ {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
+#if PY_VERSION_HEX < 0x030500A0
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
+#else
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
+#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
- PyObject *closure, PyObject *module, PyObject* code) {
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
- op->func_weakreflist = NULL;
+ __Pyx_CyFunction_weakreflist(op) = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
@@ -28624,6 +31608,8 @@ static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int f
op->func_qualname = qualname;
op->func_doc = NULL;
op->func_classobj = NULL;
+ op->func_globals = globals;
+ Py_INCREF(op->func_globals);
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
@@ -28644,6 +31630,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
Py_CLEAR(m->func_name);
Py_CLEAR(m->func_qualname);
Py_CLEAR(m->func_doc);
+ Py_CLEAR(m->func_globals);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
@@ -28662,7 +31649,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
- if (m->func_weakreflist != NULL)
+ if (__Pyx_CyFunction_weakreflist(m) != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
@@ -28675,6 +31662,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
Py_VISIT(m->func_name);
Py_VISIT(m->func_qualname);
Py_VISIT(m->func_doc);
+ Py_VISIT(m->func_globals);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
@@ -28767,66 +31755,72 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
- sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "cython_function_or_method",
+ sizeof(__pyx_CyFunctionObject),
+ 0,
+ (destructor) __Pyx_CyFunction_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
+#else
+ 0,
+#endif
+ (reprfunc) __Pyx_CyFunction_repr,
+ 0,
+ 0,
+ 0,
+ 0,
+ __Pyx_CyFunction_Call,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ 0,
+ (traverseproc) __Pyx_CyFunction_traverse,
+ (inquiry) __Pyx_CyFunction_clear,
+ 0,
+#if PY_VERSION_HEX < 0x030500A0
+ offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
- 0, /*reserved*/
+ offsetof(PyCFunctionObject, m_weakreflist),
#endif
- (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- __Pyx_CyFunction_Call, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
- (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_CyFunction_methods, /*tp_methods*/
- __pyx_CyFunction_members, /*tp_members*/
- __pyx_CyFunction_getsets, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- __Pyx_CyFunction_descr_get, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ 0,
+ 0,
+ __pyx_CyFunction_methods,
+ __pyx_CyFunction_members,
+ __pyx_CyFunction_getsets,
+ 0,
+ 0,
+ __Pyx_CyFunction_descr_get,
+ 0,
+ offsetof(__pyx_CyFunctionObject, func_dict),
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ 0,
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
__pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
- if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
+ __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
+ if (__pyx_CyFunctionType == NULL) {
return -1;
- __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
+ }
return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
@@ -28875,12 +31869,132 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec
if (default_value == Py_None)
default_value = NULL;
value = PyObject_CallMethodObjArgs(
- d, __pyx_n_s__get, key, default_value, NULL);
+ d, __pyx_n_s_get_2, key, default_value, NULL);
}
#endif
return value;
}
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+ if (s1 == s2) {
+ return (equals == Py_EQ);
+ } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
+ const char *ps1, *ps2;
+ Py_ssize_t length = PyBytes_GET_SIZE(s1);
+ if (length != PyBytes_GET_SIZE(s2))
+ return (equals == Py_NE);
+ ps1 = PyBytes_AS_STRING(s1);
+ ps2 = PyBytes_AS_STRING(s2);
+ if (ps1[0] != ps2[0]) {
+ return (equals == Py_NE);
+ } else if (length == 1) {
+ return (equals == Py_EQ);
+ } else {
+ int result = memcmp(ps1, ps2, (size_t)length);
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
+ return (equals == Py_NE);
+ } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
+ return (equals == Py_NE);
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+#endif
+}
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyObject_RichCompareBool(s1, s2, equals);
+#else
+#if PY_MAJOR_VERSION < 3
+ PyObject* owned_ref = NULL;
+#endif
+ int s1_is_unicode, s2_is_unicode;
+ if (s1 == s2) {
+ goto return_eq;
+ }
+ s1_is_unicode = PyUnicode_CheckExact(s1);
+ s2_is_unicode = PyUnicode_CheckExact(s2);
+#if PY_MAJOR_VERSION < 3
+ if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
+ owned_ref = PyUnicode_FromObject(s2);
+ if (unlikely(!owned_ref))
+ return -1;
+ s2 = owned_ref;
+ s2_is_unicode = 1;
+ } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
+ owned_ref = PyUnicode_FromObject(s1);
+ if (unlikely(!owned_ref))
+ return -1;
+ s1 = owned_ref;
+ s1_is_unicode = 1;
+ } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
+ return __Pyx_PyBytes_Equals(s1, s2, equals);
+ }
+#endif
+ if (s1_is_unicode & s2_is_unicode) {
+ Py_ssize_t length;
+ int kind;
+ void *data1, *data2;
+ if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
+ return -1;
+ length = __Pyx_PyUnicode_GET_LENGTH(s1);
+ if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
+ goto return_ne;
+ }
+ kind = __Pyx_PyUnicode_KIND(s1);
+ if (kind != __Pyx_PyUnicode_KIND(s2)) {
+ goto return_ne;
+ }
+ data1 = __Pyx_PyUnicode_DATA(s1);
+ data2 = __Pyx_PyUnicode_DATA(s2);
+ if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
+ goto return_ne;
+ } else if (length == 1) {
+ goto return_eq;
+ } else {
+ int result = memcmp(data1, data2, (size_t)(length * kind));
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ) ? (result == 0) : (result != 0);
+ }
+ } else if ((s1 == Py_None) & s2_is_unicode) {
+ goto return_ne;
+ } else if ((s2 == Py_None) & s1_is_unicode) {
+ goto return_ne;
+ } else {
+ int result;
+ PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+ if (!py_result)
+ return -1;
+ result = __Pyx_PyObject_IsTrue(py_result);
+ Py_DECREF(py_result);
+ return result;
+ }
+return_eq:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_EQ);
+return_ne:
+ #if PY_MAJOR_VERSION < 3
+ Py_XDECREF(owned_ref);
+ #endif
+ return (equals == Py_NE);
+#endif
+}
+
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
@@ -28920,72 +32034,15 @@ bad:
return (double)-1;
}
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
- PyObject *local_type, *local_value, *local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
- PyObject *tmp_type, *tmp_value, *tmp_tb;
- PyThreadState *tstate = PyThreadState_GET();
- local_type = tstate->curexc_type;
- local_value = tstate->curexc_value;
- local_tb = tstate->curexc_traceback;
- tstate->curexc_type = 0;
- tstate->curexc_value = 0;
- tstate->curexc_traceback = 0;
-#else
- PyErr_Fetch(&local_type, &local_value, &local_tb);
-#endif
- PyErr_NormalizeException(&local_type, &local_value, &local_tb);
-#if CYTHON_COMPILING_IN_CPYTHON
- if (unlikely(tstate->curexc_type))
-#else
- if (unlikely(PyErr_Occurred()))
-#endif
- goto bad;
- #if PY_MAJOR_VERSION >= 3
- if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
- goto bad;
- #endif
- Py_INCREF(local_type);
- Py_INCREF(local_value);
- Py_INCREF(local_tb);
- *type = local_type;
- *value = local_value;
- *tb = local_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
- tmp_type = tstate->exc_type;
- tmp_value = tstate->exc_value;
- tmp_tb = tstate->exc_traceback;
- tstate->exc_type = local_type;
- tstate->exc_value = local_value;
- tstate->exc_traceback = local_tb;
- /* Make sure tstate is in a consistent state when we XDECREF
- these objects (DECREF may run arbitrary code). */
- Py_XDECREF(tmp_type);
- Py_XDECREF(tmp_value);
- Py_XDECREF(tmp_tb);
-#else
- PyErr_SetExcInfo(local_type, local_value, local_tb);
-#endif
- return 0;
-bad:
- *type = 0;
- *value = 0;
- *tb = 0;
- Py_XDECREF(local_type);
- Py_XDECREF(local_value);
- Py_XDECREF(local_tb);
- return -1;
-}
-
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
if (!ob)
goto bad;
- if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
+ if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
goto bad;
Py_DECREF(ob);
return 0;
@@ -28996,10 +32053,10 @@ bad:
static void* __Pyx_GetVtable(PyObject *dict) {
void* ptr;
- PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__);
+ PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
if (!ob)
goto bad;
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
ptr = PyCapsule_GetPointer(ob, 0);
#else
ptr = PyCObject_AsVoidPtr(ob);
@@ -29013,841 +32070,901 @@ bad:
return NULL;
}
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
- PyThreadState *tstate = PyThreadState_GET();
- *type = tstate->exc_type;
- *value = tstate->exc_value;
- *tb = tstate->exc_traceback;
- Py_XINCREF(*type);
- Py_XINCREF(*value);
- Py_XINCREF(*tb);
-#else
- PyErr_GetExcInfo(type, value, tb);
+static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
+ Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
+ for (i=0; i < nbases; i++) {
+ PyTypeObject *tmptype;
+ PyObject *tmp = PyTuple_GET_ITEM(bases, i);
+ tmptype = Py_TYPE(tmp);
+#if PY_MAJOR_VERSION < 3
+ if (tmptype == &PyClass_Type)
+ continue;
#endif
-}
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
-#if CYTHON_COMPILING_IN_CPYTHON
- PyObject *tmp_type, *tmp_value, *tmp_tb;
- PyThreadState *tstate = PyThreadState_GET();
- tmp_type = tstate->exc_type;
- tmp_value = tstate->exc_value;
- tmp_tb = tstate->exc_traceback;
- tstate->exc_type = type;
- tstate->exc_value = value;
- tstate->exc_traceback = tb;
- Py_XDECREF(tmp_type);
- Py_XDECREF(tmp_value);
- Py_XDECREF(tmp_tb);
+ if (!metaclass) {
+ metaclass = tmptype;
+ continue;
+ }
+ if (PyType_IsSubtype(metaclass, tmptype))
+ continue;
+ if (PyType_IsSubtype(tmptype, metaclass)) {
+ metaclass = tmptype;
+ continue;
+ }
+ PyErr_SetString(PyExc_TypeError,
+ "metaclass conflict: "
+ "the metaclass of a derived class "
+ "must be a (non-strict) subclass "
+ "of the metaclasses of all its bases");
+ return NULL;
+ }
+ if (!metaclass) {
+#if PY_MAJOR_VERSION < 3
+ metaclass = &PyClass_Type;
#else
- PyErr_SetExcInfo(type, value, tb);
+ metaclass = &PyType_Type;
#endif
+ }
+ Py_INCREF((PyObject*) metaclass);
+ return (PyObject*) metaclass;
}
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
- PyObject *empty_list = 0;
- PyObject *module = 0;
- PyObject *global_dict = 0;
- PyObject *empty_dict = 0;
- PyObject *list;
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_import;
- py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
- if (!py_import)
- goto bad;
- #endif
- if (from_list)
- list = from_list;
- else {
- empty_list = PyList_New(0);
- if (!empty_list)
- goto bad;
- list = empty_list;
- }
- global_dict = PyModule_GetDict(__pyx_m);
- if (!global_dict)
- goto bad;
- empty_dict = PyDict_New();
- if (!empty_dict)
- goto bad;
- #if PY_VERSION_HEX >= 0x02050000
- {
- #if PY_MAJOR_VERSION >= 3
- if (level == -1) {
- if (strchr(__Pyx_MODULE_NAME, '.')) {
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_level = PyInt_FromLong(1);
- if (!py_level)
- goto bad;
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, py_level, NULL);
- Py_DECREF(py_level);
- #else
- module = PyImport_ImportModuleLevelObject(
- name, global_dict, empty_dict, list, 1);
- #endif
- if (!module) {
- if (!PyErr_ExceptionMatches(PyExc_ImportError))
- goto bad;
- PyErr_Clear();
- }
+static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
+ PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
+ PyObject *ns;
+ if (metaclass) {
+ PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
+ if (prep) {
+ PyObject *pargs = PyTuple_Pack(2, name, bases);
+ if (unlikely(!pargs)) {
+ Py_DECREF(prep);
+ return NULL;
}
- level = 0; /* try absolute import on failure */
- }
- #endif
- if (!module) {
- #if PY_VERSION_HEX < 0x03030000
- PyObject *py_level = PyInt_FromLong(level);
- if (!py_level)
- goto bad;
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, py_level, NULL);
- Py_DECREF(py_level);
- #else
- module = PyImport_ImportModuleLevelObject(
- name, global_dict, empty_dict, list, level);
- #endif
+ ns = PyObject_Call(prep, pargs, mkw);
+ Py_DECREF(prep);
+ Py_DECREF(pargs);
+ } else {
+ if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
+ return NULL;
+ PyErr_Clear();
+ ns = PyDict_New();
}
+ } else {
+ ns = PyDict_New();
}
- #else
- if (level>0) {
- PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
- goto bad;
- }
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, NULL);
- #endif
+ if (unlikely(!ns))
+ return NULL;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
+ if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
+ if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
+ return ns;
bad:
- #if PY_VERSION_HEX < 0x03030000
- Py_XDECREF(py_import);
- #endif
- Py_XDECREF(empty_list);
- Py_XDECREF(empty_dict);
- return module;
+ Py_DECREF(ns);
+ return NULL;
}
-
-static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
- PyObject *metaclass;
-#if PY_MAJOR_VERSION < 3
- if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
- PyObject *base = PyTuple_GET_ITEM(bases, 0);
- metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
- if (!metaclass) {
+static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
+ PyObject *dict, PyObject *mkw,
+ int calculate_metaclass, int allow_py2_metaclass) {
+ PyObject *result, *margs;
+ PyObject *owned_metaclass = NULL;
+ if (allow_py2_metaclass) {
+ owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
+ if (owned_metaclass) {
+ metaclass = owned_metaclass;
+ } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
PyErr_Clear();
- metaclass = (PyObject*) Py_TYPE(base);
+ } else {
+ return NULL;
}
- } else {
- metaclass = (PyObject *) &PyClass_Type;
}
-#else
- if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
- PyObject *base = PyTuple_GET_ITEM(bases, 0);
- metaclass = (PyObject*) Py_TYPE(base);
- } else {
- metaclass = (PyObject *) &PyType_Type;
+ if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
+ metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
+ Py_XDECREF(owned_metaclass);
+ if (unlikely(!metaclass))
+ return NULL;
+ owned_metaclass = metaclass;
}
-#endif
- Py_INCREF(metaclass);
- return metaclass;
-}
-
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
- PyObject *qualname, PyObject *modname) {
- PyObject *result;
- PyObject *metaclass;
- if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
- return NULL;
- if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
- return NULL;
- metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
- if (metaclass) {
- Py_INCREF(metaclass);
+ margs = PyTuple_Pack(3, name, bases, dict);
+ if (unlikely(!margs)) {
+ result = NULL;
} else {
- metaclass = __Pyx_FindPy2Metaclass(bases);
+ result = PyObject_Call(metaclass, margs, mkw);
+ Py_DECREF(margs);
}
- result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
- Py_DECREF(metaclass);
+ Py_XDECREF(owned_metaclass);
return result;
}
-static CYTHON_INLINE WordID __Pyx_PyInt_from_py_WordID(PyObject* x) {
- const WordID neg_one = (WordID)-1, const_zero = (WordID)0;
- const int is_unsigned = const_zero < neg_one;
- if (sizeof(WordID) == sizeof(char)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedChar(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedChar(x);
- } else if (sizeof(WordID) == sizeof(short)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedShort(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedShort(x);
- } else if (sizeof(WordID) == sizeof(int)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedInt(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedInt(x);
- } else if (sizeof(WordID) == sizeof(long)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedLong(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedLong(x);
- } else if (sizeof(WordID) == sizeof(PY_LONG_LONG)) {
- if (is_unsigned)
- return (WordID)__Pyx_PyInt_AsUnsignedLongLong(x);
- else
- return (WordID)__Pyx_PyInt_AsSignedLongLong(x);
- } else {
- #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
- PyErr_SetString(PyExc_RuntimeError,
- "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
- #else
- WordID val;
- PyObject *v = __Pyx_PyNumber_Int(x);
- #if PY_MAJOR_VERSION < 3
- if (likely(v) && !PyLong_Check(v)) {
- PyObject *tmp = v;
- v = PyNumber_Long(tmp);
- Py_DECREF(tmp);
- }
- #endif
- if (likely(v)) {
- int one = 1; int is_little = (int)*(unsigned char *)&one;
- unsigned char *bytes = (unsigned char *)&val;
- int ret = _PyLong_AsByteArray((PyLongObject *)v,
- bytes, sizeof(val),
- is_little, !is_unsigned);
- Py_DECREF(v);
- if (likely(!ret))
- return val;
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
}
- #endif
- return (WordID)-1;
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
}
}
-
-static PyObject* __Pyx_Globals(void) {
- Py_ssize_t i;
- PyObject *names = NULL;
- PyObject *globals = PyObject_GetAttr(__pyx_m, __pyx_n_s____dict__);
- if (!globals) {
- PyErr_SetString(PyExc_TypeError,
- "current module must have __dict__ attribute");
- goto bad;
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
}
- names = PyObject_Dir(__pyx_m);
- if (!names)
- goto bad;
- for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
-#if CYTHON_COMPILING_IN_PYPY
- PyObject* name = PySequence_GetItem(names, i);
- if (!name)
- goto bad;
-#else
- PyObject* name = PyList_GET_ITEM(names, i);
-#endif
- if (!PyDict_Contains(globals, name)) {
- PyObject* value = PyObject_GetAttr(__pyx_m, name);
- if (!value) {
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
- goto bad;
- }
- if (PyDict_SetItem(globals, name, value) < 0) {
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
- Py_DECREF(value);
- goto bad;
- }
- }
-#if CYTHON_COMPILING_IN_PYPY
- Py_DECREF(name);
-#endif
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
}
- Py_DECREF(names);
- return globals;
-bad:
- Py_XDECREF(names);
- Py_XDECREF(globals);
- return NULL;
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
}
-
-static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
- const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned char" :
- "value too large to convert to unsigned char");
- }
- return (unsigned char)-1;
- }
- return (unsigned char)val;
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
}
- return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
- const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned short" :
- "value too large to convert to unsigned short");
- }
- return (unsigned short)-1;
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
}
- return (unsigned short)val;
+ return;
}
- return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
- const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(unsigned int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(unsigned int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to unsigned int" :
- "value too large to convert to unsigned int");
- }
- return (unsigned int)-1;
- }
- return (unsigned int)val;
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
}
- return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
-}
-
-static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
- const char neg_one = (char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to char" :
- "value too large to convert to char");
- }
- return (char)-1;
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
}
- return (char)val;
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
}
- return (char)__Pyx_PyInt_AsLong(x);
-}
-
-static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
- const short neg_one = (short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to short" :
- "value too large to convert to short");
- }
- return (short)-1;
- }
- return (short)val;
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
}
- return (short)__Pyx_PyInt_AsLong(x);
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
}
-static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
- const int neg_one = (int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to int" :
- "value too large to convert to int");
- }
- return (int)-1;
- }
- return (int)val;
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
}
- return (int)__Pyx_PyInt_AsLong(x);
-}
-
-static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
- const signed char neg_one = (signed char)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed char) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed char)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed char" :
- "value too large to convert to signed char");
- }
- return (signed char)-1;
- }
- return (signed char)val;
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
}
- return (signed char)__Pyx_PyInt_AsSignedLong(x);
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
}
-
-static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
- const signed short neg_one = (signed short)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed short) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed short)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed short" :
- "value too large to convert to signed short");
- }
- return (signed short)-1;
- }
- return (signed short)val;
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
- return (signed short)__Pyx_PyInt_AsSignedLong(x);
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
}
-static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
- const signed int neg_one = (signed int)-1, const_zero = 0;
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
+ const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
- if (sizeof(signed int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(signed int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to signed int" :
- "value too large to convert to signed int");
- }
- return (signed int)-1;
+ if (is_unsigned) {
+ if (sizeof(unsigned int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(unsigned int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(unsigned int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
}
- return (signed int)val;
}
- return (signed int)__Pyx_PyInt_AsSignedLong(x);
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
+ little, !is_unsigned);
+ }
}
-static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
- const int neg_one = (int)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
- if (sizeof(int) < sizeof(long)) {
- long val = __Pyx_PyInt_AsLong(x);
- if (unlikely(val != (long)(int)val)) {
- if (!unlikely(val == -1 && PyErr_Occurred())) {
- PyErr_SetString(PyExc_OverflowError,
- (is_unsigned && unlikely(val < 0)) ?
- "can't convert negative value to int" :
- "value too large to convert to int");
- }
- return (int)-1;
- }
- return (int)val;
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
+ { \
+ func_type value = func_value; \
+ if (sizeof(target_type) < sizeof(func_type)) { \
+ if (unlikely(value != (func_type) (target_type) value)) { \
+ func_type zero = 0; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
+ } \
+ } \
+ return (target_type) value; \
}
- return (int)__Pyx_PyInt_AsLong(x);
-}
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
+ #if CYTHON_USE_PYLONG_INTERNALS
+ #include "longintrepr.h"
+ #endif
#endif
-static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
- const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
+ const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned long");
- return (unsigned long)-1;
+ if (sizeof(unsigned int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (unsigned int) val;
}
- return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned long");
- return (unsigned long)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(unsigned int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(unsigned int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x))
+ } else if (sizeof(unsigned int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ unsigned int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
#endif
- return (unsigned long)PyLong_AsLong(x);
+ return (unsigned int) -1;
}
} else {
- unsigned long val;
+ unsigned int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (unsigned long)-1;
- val = __Pyx_PyInt_AsUnsignedLong(tmp);
+ if (!tmp) return (unsigned int) -1;
+ val = __Pyx_PyInt_As_unsigned_int(tmp);
Py_DECREF(tmp);
return val;
}
-}
-
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
-#endif
-static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
- const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to unsigned int");
+ return (unsigned int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned int");
+ return (unsigned int) -1;
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
+ const int neg_one = (int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned PY_LONG_LONG");
- return (unsigned PY_LONG_LONG)-1;
+ if (sizeof(int) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (int) val;
}
- return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned PY_LONG_LONG");
- return (unsigned PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(int) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(int) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
+ } else if (sizeof(int) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ int val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
#endif
- return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (int) -1;
}
} else {
- unsigned PY_LONG_LONG val;
+ int val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (unsigned PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
+ if (!tmp) return (int) -1;
+ val = __Pyx_PyInt_As_int(tmp);
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
-#endif
-static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
- const long neg_one = (long)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
-#if PY_MAJOR_VERSION < 3
- if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to long");
- return (long)-1;
- }
- return (long)val;
- } else
-#endif
- if (likely(PyLong_Check(x))) {
- if (is_unsigned) {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
- }
- }
-#endif
-#endif
- if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to long");
- return (long)-1;
- }
- return (long)PyLong_AsUnsignedLong(x);
- } else {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
+ PyObject *empty_list = 0;
+ PyObject *module = 0;
+ PyObject *global_dict = 0;
+ PyObject *empty_dict = 0;
+ PyObject *list;
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_import;
+ py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
+ if (!py_import)
+ goto bad;
+ #endif
+ if (from_list)
+ list = from_list;
+ else {
+ empty_list = PyList_New(0);
+ if (!empty_list)
+ goto bad;
+ list = empty_list;
+ }
+ global_dict = PyModule_GetDict(__pyx_m);
+ if (!global_dict)
+ goto bad;
+ empty_dict = PyDict_New();
+ if (!empty_dict)
+ goto bad;
+ {
+ #if PY_MAJOR_VERSION >= 3
+ if (level == -1) {
+ if (strchr(__Pyx_MODULE_NAME, '.')) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(1);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, 1);
+ #endif
+ if (!module) {
+ if (!PyErr_ExceptionMatches(PyExc_ImportError))
+ goto bad;
+ PyErr_Clear();
}
}
-#endif
-#endif
- return (long)PyLong_AsLong(x);
+ level = 0;
+ }
+ #endif
+ if (!module) {
+ #if PY_VERSION_HEX < 0x03030000
+ PyObject *py_level = PyInt_FromLong(level);
+ if (!py_level)
+ goto bad;
+ module = PyObject_CallFunctionObjArgs(py_import,
+ name, global_dict, empty_dict, list, py_level, NULL);
+ Py_DECREF(py_level);
+ #else
+ module = PyImport_ImportModuleLevelObject(
+ name, global_dict, empty_dict, list, level);
+ #endif
+ }
+ }
+bad:
+ #if PY_VERSION_HEX < 0x03030000
+ Py_XDECREF(py_import);
+ #endif
+ Py_XDECREF(empty_list);
+ Py_XDECREF(empty_dict);
+ return module;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
+ const int neg_one = (int) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(int) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(int) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
}
} else {
- long val;
- PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (long)-1;
- val = __Pyx_PyInt_AsLong(tmp);
- Py_DECREF(tmp);
- return val;
+ if (sizeof(int) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(int) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(int),
+ little, !is_unsigned);
}
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
-#endif
-static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
- const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
+ const long neg_one = (long) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(long) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(long) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(long) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(long),
+ little, !is_unsigned);
+ }
+}
+
+static CYTHON_INLINE WordID __Pyx_PyInt_As_WordID(PyObject *x) {
+ const WordID neg_one = (WordID) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to PY_LONG_LONG");
- return (PY_LONG_LONG)-1;
+ if (sizeof(WordID) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (WordID) val;
}
- return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(WordID, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to PY_LONG_LONG");
- return (PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(WordID) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(WordID) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(WordID, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(WordID, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(WordID) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long, PyLong_AsLong(x))
+ } else if (sizeof(WordID) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(WordID, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ WordID val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
#endif
- return (PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (WordID) -1;
}
} else {
- PY_LONG_LONG val;
+ WordID val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsLongLong(tmp);
+ if (!tmp) return (WordID) -1;
+ val = __Pyx_PyInt_As_WordID(tmp);
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to WordID");
+ return (WordID) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to WordID");
+ return (WordID) -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
+ const short neg_one = (short) -1, const_zero = 0;
+ const int is_unsigned = neg_one > const_zero;
+ if (is_unsigned) {
+ if (sizeof(short) < sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long)) {
+ return PyLong_FromUnsignedLong((unsigned long) value);
+ } else if (sizeof(short) <= sizeof(unsigned long long)) {
+ return PyLong_FromUnsignedLongLong((unsigned long long) value);
+ }
+ } else {
+ if (sizeof(short) <= sizeof(long)) {
+ return PyInt_FromLong((long) value);
+ } else if (sizeof(short) <= sizeof(long long)) {
+ return PyLong_FromLongLong((long long) value);
+ }
+ }
+ {
+ int one = 1; int little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&value;
+ return _PyLong_FromByteArray(bytes, sizeof(short),
+ little, !is_unsigned);
+ }
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
+#if CYTHON_COMPILING_IN_CPYTHON
+#if PY_MAJOR_VERSION >= 3
+ if (likely(PyUnicode_Check(n)))
+#else
+ if (likely(PyString_Check(n)))
#endif
+ return __Pyx_PyObject_GetAttrStr(o, n);
#endif
-static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
- const signed long neg_one = (signed long)-1, const_zero = 0;
- const int is_unsigned = neg_one > const_zero;
-#if PY_MAJOR_VERSION < 3
- if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed long");
- return (signed long)-1;
- }
- return (signed long)val;
- } else
-#endif
- if (likely(PyLong_Check(x))) {
- if (is_unsigned) {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(signed long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
- }
- }
+ return PyObject_GetAttr(o, n);
+}
+
+static PyObject* __Pyx_Globals(void) {
+ Py_ssize_t i;
+ PyObject *names;
+ PyObject *globals = __pyx_d;
+ Py_INCREF(globals);
+ names = PyObject_Dir(__pyx_m);
+ if (!names)
+ goto bad;
+ for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
+#if CYTHON_COMPILING_IN_PYPY
+ PyObject* name = PySequence_GetItem(names, i);
+ if (!name)
+ goto bad;
+#else
+ PyObject* name = PyList_GET_ITEM(names, i);
#endif
+ if (!PyDict_Contains(globals, name)) {
+ PyObject* value = __Pyx_GetAttr(__pyx_m, name);
+ if (!value) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
#endif
- if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed long");
- return (signed long)-1;
- }
- return (signed long)PyLong_AsUnsignedLong(x);
- } else {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(signed long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
- }
+ goto bad;
}
+ if (PyDict_SetItem(globals, name, value) < 0) {
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
#endif
-#endif
- return (signed long)PyLong_AsLong(x);
+ Py_DECREF(value);
+ goto bad;
+ }
}
- } else {
- signed long val;
- PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (signed long)-1;
- val = __Pyx_PyInt_AsSignedLong(tmp);
- Py_DECREF(tmp);
- return val;
+#if CYTHON_COMPILING_IN_PYPY
+ Py_DECREF(name);
+#endif
}
+ Py_DECREF(names);
+ return globals;
+bad:
+ Py_XDECREF(names);
+ Py_XDECREF(globals);
+ return NULL;
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
-#include "longintrepr.h"
-#endif
-#endif
-static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
- const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
+ const long neg_one = (long) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
- long val = PyInt_AS_LONG(x);
- if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed PY_LONG_LONG");
- return (signed PY_LONG_LONG)-1;
+ if (sizeof(long) < sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
+ } else {
+ long val = PyInt_AS_LONG(x);
+ if (is_unsigned && unlikely(val < 0)) {
+ goto raise_neg_overflow;
+ }
+ return (long) val;
}
- return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
}
-#endif
+ #endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to signed PY_LONG_LONG");
- return (signed PY_LONG_LONG)-1;
+ goto raise_neg_overflow;
+ }
+ if (sizeof(long) <= sizeof(unsigned long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
+ } else if (sizeof(long) <= sizeof(unsigned long long)) {
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
- return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
-#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
- }
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
+ #endif
#endif
+ if (sizeof(long) <= sizeof(long)) {
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
+ } else if (sizeof(long) <= sizeof(long long)) {
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
+ }
+ }
+ {
+#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
+ PyErr_SetString(PyExc_RuntimeError,
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
+#else
+ long val;
+ PyObject *v = __Pyx_PyNumber_Int(x);
+ #if PY_MAJOR_VERSION < 3
+ if (likely(v) && !PyLong_Check(v)) {
+ PyObject *tmp = v;
+ v = PyNumber_Long(tmp);
+ Py_DECREF(tmp);
+ }
+ #endif
+ if (likely(v)) {
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
+ unsigned char *bytes = (unsigned char *)&val;
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
+ bytes, sizeof(val),
+ is_little, !is_unsigned);
+ Py_DECREF(v);
+ if (likely(!ret))
+ return val;
+ }
#endif
- return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
+ return (long) -1;
}
} else {
- signed PY_LONG_LONG val;
+ long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
- if (!tmp) return (signed PY_LONG_LONG)-1;
- val = __Pyx_PyInt_AsSignedLongLong(tmp);
+ if (!tmp) return (long) -1;
+ val = __Pyx_PyInt_As_long(tmp);
Py_DECREF(tmp);
return val;
}
-}
-
-static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
- PyObject *tmp_type, *tmp_value, *tmp_tb;
-#if CYTHON_COMPILING_IN_CPYTHON
- PyThreadState *tstate = PyThreadState_GET();
- tmp_type = tstate->exc_type;
- tmp_value = tstate->exc_value;
- tmp_tb = tstate->exc_traceback;
- tstate->exc_type = *type;
- tstate->exc_value = *value;
- tstate->exc_traceback = *tb;
-#else
- PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
- PyErr_SetExcInfo(*type, *value, *tb);
-#endif
- *type = tmp_type;
- *value = tmp_value;
- *tb = tmp_tb;
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
}
static PyObject *__Pyx_Generator_Next(PyObject *self);
@@ -29899,7 +33016,7 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
Py_DECREF(ev);
#else
{
- PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args);
+ PyObject* args = PyObject_GetAttr(ev, __pyx_n_s_args);
Py_DECREF(ev);
if (likely(args)) {
value = PyObject_GetItem(args, 0);
@@ -29956,8 +33073,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Generators always return to their most recent caller, not
- * necessarily their creator. */
if (self->exc_traceback) {
PyThreadState *tstate = PyThreadState_GET();
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
@@ -29980,9 +33095,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
&self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Don't keep the reference to f_back any longer than necessary. It
- * may keep a chain of frames alive or it could create a reference
- * cycle. */
if (self->exc_traceback) {
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
PyFrameObject *f = tb->tb_frame;
@@ -30035,7 +33147,7 @@ static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) {
if (value == Py_None)
ret = PyIter_Next(yf);
else
- ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value);
+ ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
}
gen->is_running = 0;
if (likely(ret)) {
@@ -30055,7 +33167,7 @@ static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) {
} else {
PyObject *meth;
gen->is_running = 1;
- meth = PyObject_GetAttr(yf, __pyx_n_s__close);
+ meth = PyObject_GetAttr(yf, __pyx_n_s_close);
if (unlikely(!meth)) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_WriteUnraisable(yf);
@@ -30086,11 +33198,7 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
Py_DECREF(yf);
}
if (err == 0)
-#if PY_VERSION_HEX < 0x02050000
- PyErr_SetNone(PyExc_StopIteration);
-#else
PyErr_SetNone(PyExc_GeneratorExit);
-#endif
retval = __Pyx_Generator_SendEx(gen, NULL);
if (retval) {
Py_DECREF(retval);
@@ -30101,13 +33209,11 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
raised_exception = PyErr_Occurred();
if (!raised_exception
|| raised_exception == PyExc_StopIteration
-#if PY_VERSION_HEX >= 0x02050000
|| raised_exception == PyExc_GeneratorExit
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
-#endif
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
{
- if (raised_exception) PyErr_Clear(); /* ignore these errors */
+ if (raised_exception) PyErr_Clear();
Py_INCREF(Py_None);
return Py_None;
}
@@ -30126,7 +33232,6 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
if (yf) {
PyObject *ret;
Py_INCREF(yf);
-#if PY_VERSION_HEX >= 0x02050000
if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
int err = __Pyx_Generator_CloseIter(gen, yf);
Py_DECREF(yf);
@@ -30135,12 +33240,11 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
return __Pyx_Generator_SendEx(gen, NULL);
goto throw_here;
}
-#endif
gen->is_running = 1;
if (__Pyx_Generator_CheckExact(yf)) {
ret = __Pyx_Generator_Throw(yf, args);
} else {
- PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw);
+ PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s_throw);
if (unlikely(!meth)) {
Py_DECREF(yf);
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -30184,6 +33288,8 @@ static int __Pyx_Generator_clear(PyObject *self) {
Py_CLEAR(gen->exc_type);
Py_CLEAR(gen->exc_value);
Py_CLEAR(gen->exc_traceback);
+ Py_CLEAR(gen->gi_name);
+ Py_CLEAR(gen->gi_qualname);
return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
@@ -30191,13 +33297,19 @@ static void __Pyx_Generator_dealloc(PyObject *self) {
PyObject_GC_UnTrack(gen);
if (gen->gi_weakreflist != NULL)
PyObject_ClearWeakRefs(self);
- PyObject_GC_Track(self);
if (gen->resume_label > 0) {
+ PyObject_GC_Track(self);
+#if PY_VERSION_HEX >= 0x030400a1
+ if (PyObject_CallFinalizerFromDealloc(self))
+#else
Py_TYPE(gen)->tp_del(self);
if (self->ob_refcnt > 0)
- return; /* resurrected. :( */
+#endif
+ {
+ return;
+ }
+ PyObject_GC_UnTrack(self);
}
- PyObject_GC_UnTrack(self);
__Pyx_Generator_clear(self);
PyObject_GC_Del(gen);
}
@@ -30207,8 +33319,10 @@ static void __Pyx_Generator_del(PyObject *self) {
__pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self;
if (gen->resume_label <= 0)
return ;
+#if PY_VERSION_HEX < 0x030400a1
assert(self->ob_refcnt == 0);
self->ob_refcnt = 1;
+#endif
__Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
res = __Pyx_Generator_Close(self);
if (res == NULL)
@@ -30216,15 +33330,11 @@ static void __Pyx_Generator_del(PyObject *self) {
else
Py_DECREF(res);
__Pyx_ErrRestore(error_type, error_value, error_traceback);
- /* Undo the temporary resurrection; can't use DECREF here, it would
- * cause a recursive call.
- */
+#if PY_VERSION_HEX < 0x030400a1
assert(self->ob_refcnt > 0);
- if (--self->ob_refcnt == 0)
- return; /* this is the normal path out */
- /* close() resurrected it! Make it look like the original Py_DECREF
- * never happened.
- */
+ if (--self->ob_refcnt == 0) {
+ return;
+ }
{
Py_ssize_t refcnt = self->ob_refcnt;
_Py_NewReference(self);
@@ -30233,96 +33343,143 @@ static void __Pyx_Generator_del(PyObject *self) {
#if CYTHON_COMPILING_IN_CPYTHON
assert(PyType_IS_GC(self->ob_type) &&
_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
- /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
- * we need to undo that. */
_Py_DEC_REFTOTAL;
#endif
- /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
- * chain, so no more to do there.
- * If COUNT_ALLOCS, the original decref bumped tp_frees, and
- * _Py_NewReference bumped tp_allocs: both of those need to be
- * undone.
- */
#ifdef COUNT_ALLOCS
--Py_TYPE(self)->tp_frees;
--Py_TYPE(self)->tp_allocs;
#endif
+#endif
}
-static PyMemberDef __pyx_Generator_memberlist[] = {
- {(char *) "gi_running",
-#if PY_VERSION_HEX >= 0x02060000
- T_BOOL,
+static PyObject *
+__Pyx_Generator_get_name(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_name);
+ return self->gi_name;
+}
+static int
+__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
- T_BYTE,
+ if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
- offsetof(__pyx_GeneratorObject, is_running),
- READONLY,
- NULL},
+ PyErr_SetString(PyExc_TypeError,
+ "__name__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_name;
+ Py_INCREF(value);
+ self->gi_name = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyObject *
+__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_qualname);
+ return self->gi_qualname;
+}
+static int
+__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
+#else
+ if (unlikely(value == NULL || !PyString_Check(value))) {
+#endif
+ PyErr_SetString(PyExc_TypeError,
+ "__qualname__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_qualname;
+ Py_INCREF(value);
+ self->gi_qualname = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyGetSetDef __pyx_Generator_getsets[] = {
+ {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name,
+ (char*) PyDoc_STR("name of the generator"), 0},
+ {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname,
+ (char*) PyDoc_STR("qualified name of the generator"), 0},
+ {0, 0, 0, 0, 0}
+};
+static PyMemberDef __pyx_Generator_memberlist[] = {
+ {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL},
{0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
- {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
- {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
- {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
+ {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
+ {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
+ {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("generator"), /*tp_name*/
- sizeof(__pyx_GeneratorObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "generator",
+ sizeof(__pyx_GeneratorObject),
+ 0,
+ (destructor) __Pyx_Generator_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
+#else
+ 0,
+#endif
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
+ 0,
+ (traverseproc) __Pyx_Generator_traverse,
+ 0,
+ 0,
+ offsetof(__pyx_GeneratorObject, gi_weakreflist),
+ 0,
+ (iternextfunc) __Pyx_Generator_Next,
+ __pyx_Generator_methods,
+ __pyx_Generator_memberlist,
+ __pyx_Generator_getsets,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ 0,
#else
- 0, /*reserved*/
+ __Pyx_Generator_del,
#endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
- __pyx_Generator_methods, /*tp_methods*/
- __pyx_Generator_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- __Pyx_Generator_del, /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ 0,
+#if PY_VERSION_HEX >= 0x030400a1
+ __Pyx_Generator_del,
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure) {
+ PyObject *closure, PyObject *name, PyObject *qualname) {
__pyx_GeneratorObject *gen =
PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
if (gen == NULL)
@@ -30338,16 +33495,20 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
gen->exc_value = NULL;
gen->exc_traceback = NULL;
gen->gi_weakreflist = NULL;
+ Py_XINCREF(qualname);
+ gen->gi_qualname = qualname;
+ Py_XINCREF(name);
+ gen->gi_name = name;
PyObject_GC_Track(gen);
return gen;
}
static int __pyx_Generator_init(void) {
__pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr;
__pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
- if (PyType_Ready(&__pyx_GeneratorType_type)) {
+ __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
+ if (__pyx_GeneratorType == NULL) {
return -1;
}
- __pyx_GeneratorType = &__pyx_GeneratorType_type;
return 0;
}
@@ -30361,11 +33522,7 @@ static int __Pyx_check_binary_version(void) {
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
- #if PY_VERSION_HEX < 0x02050000
- return PyErr_Warn(NULL, message);
- #else
return PyErr_WarnEx(NULL, message, 1);
- #endif
}
return 0;
}
@@ -30415,7 +33572,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
- "%s.%s is not a type object",
+ "%.200s.%.200s is not a type object",
module_name, class_name);
goto bad;
}
@@ -30435,15 +33592,11 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class
PyOS_snprintf(warning, sizeof(warning),
"%s.%s size changed, may indicate binary incompatibility",
module_name, class_name);
- #if PY_VERSION_HEX < 0x02050000
- if (PyErr_Warn(NULL, warning) < 0) goto bad;
- #else
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
- #endif
}
else if ((size_t)basicsize != size) {
PyErr_Format(PyExc_ValueError,
- "%s.%s has the wrong size, try recompiling",
+ "%.200s.%.200s has the wrong size, try recompiling",
module_name, class_name);
goto bad;
}
@@ -30470,14 +33623,14 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
- "%s does not export expected C function %s",
+ "%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
+ "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
goto bad;
}
@@ -30491,7 +33644,7 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
+ "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
goto bad;
}
@@ -30508,168 +33661,6 @@ bad:
}
#endif
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
- int start = 0, mid = 0, end = count - 1;
- if (end >= 0 && code_line > entries[end].code_line) {
- return count;
- }
- while (start < end) {
- mid = (start + end) / 2;
- if (code_line < entries[mid].code_line) {
- end = mid;
- } else if (code_line > entries[mid].code_line) {
- start = mid + 1;
- } else {
- return mid;
- }
- }
- if (code_line <= entries[mid].code_line) {
- return mid;
- } else {
- return mid + 1;
- }
-}
-static PyCodeObject *__pyx_find_code_object(int code_line) {
- PyCodeObject* code_object;
- int pos;
- if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
- return NULL;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
- return NULL;
- }
- code_object = __pyx_code_cache.entries[pos].code_object;
- Py_INCREF(code_object);
- return code_object;
-}
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
- int pos, i;
- __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
- if (unlikely(!code_line)) {
- return;
- }
- if (unlikely(!entries)) {
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
- if (likely(entries)) {
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = 64;
- __pyx_code_cache.count = 1;
- entries[0].code_line = code_line;
- entries[0].code_object = code_object;
- Py_INCREF(code_object);
- }
- return;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
- PyCodeObject* tmp = entries[pos].code_object;
- entries[pos].code_object = code_object;
- Py_DECREF(tmp);
- return;
- }
- if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
- int new_max = __pyx_code_cache.max_count + 64;
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
- __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
- if (unlikely(!entries)) {
- return;
- }
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = new_max;
- }
- for (i=__pyx_code_cache.count; i>pos; i--) {
- entries[i] = entries[i-1];
- }
- entries[pos].code_line = code_line;
- entries[pos].code_object = code_object;
- __pyx_code_cache.count++;
- Py_INCREF(code_object);
-}
-
-#include "compile.h"
-#include "frameobject.h"
-#include "traceback.h"
-static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
- const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_srcfile = 0;
- PyObject *py_funcname = 0;
- #if PY_MAJOR_VERSION < 3
- py_srcfile = PyString_FromString(filename);
- #else
- py_srcfile = PyUnicode_FromString(filename);
- #endif
- if (!py_srcfile) goto bad;
- if (c_line) {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #else
- py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #endif
- }
- else {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromString(funcname);
- #else
- py_funcname = PyUnicode_FromString(funcname);
- #endif
- }
- if (!py_funcname) goto bad;
- py_code = __Pyx_PyCode_New(
- 0, /*int argcount,*/
- 0, /*int kwonlyargcount,*/
- 0, /*int nlocals,*/
- 0, /*int stacksize,*/
- 0, /*int flags,*/
- __pyx_empty_bytes, /*PyObject *code,*/
- __pyx_empty_tuple, /*PyObject *consts,*/
- __pyx_empty_tuple, /*PyObject *names,*/
- __pyx_empty_tuple, /*PyObject *varnames,*/
- __pyx_empty_tuple, /*PyObject *freevars,*/
- __pyx_empty_tuple, /*PyObject *cellvars,*/
- py_srcfile, /*PyObject *filename,*/
- py_funcname, /*PyObject *name,*/
- py_line, /*int firstlineno,*/
- __pyx_empty_bytes /*PyObject *lnotab*/
- );
- Py_DECREF(py_srcfile);
- Py_DECREF(py_funcname);
- return py_code;
-bad:
- Py_XDECREF(py_srcfile);
- Py_XDECREF(py_funcname);
- return NULL;
-}
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_globals = 0;
- PyFrameObject *py_frame = 0;
- py_code = __pyx_find_code_object(c_line ? c_line : py_line);
- if (!py_code) {
- py_code = __Pyx_CreateCodeObjectForTraceback(
- funcname, c_line, py_line, filename);
- if (!py_code) goto bad;
- __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
- }
- py_globals = PyModule_GetDict(__pyx_m);
- if (!py_globals) goto bad;
- py_frame = PyFrame_New(
- PyThreadState_GET(), /*PyThreadState *tstate,*/
- py_code, /*PyCodeObject *code,*/
- py_globals, /*PyObject *globals,*/
- 0 /*PyObject *locals*/
- );
- if (!py_frame) goto bad;
- py_frame->f_lineno = py_line;
- PyTraceBack_Here(py_frame);
-bad:
- Py_XDECREF(py_code);
- Py_XDECREF(py_frame);
-}
-
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
@@ -30680,7 +33671,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
- #else /* Python 3+ has unicode identifiers */
+ #else
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
@@ -30700,8 +33691,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
return 0;
}
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
- return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
@@ -30730,29 +33721,35 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
}
}
}
-#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
-#else /* PY_VERSION_HEX < 0x03030000 */
- if (PyUnicode_READY(o) == -1) return NULL;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (PyUnicode_IS_ASCII(o)) {
- *length = PyUnicode_GET_DATA_SIZE(o);
+ *length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
-#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#else
return PyUnicode_AsUTF8AndSize(o, length);
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
-#endif /* PY_VERSION_HEX < 0x03030000 */
+#endif
+#endif
} else
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+#endif
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyByteArray_Check(o)) {
+ *length = PyByteArray_GET_SIZE(o);
+ return PyByteArray_AS_STRING(o);
+ } else
+#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
- if (r < 0) {
+ if (unlikely(r < 0)) {
return NULL;
} else {
return result;
@@ -30797,7 +33794,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
- "__%s__ returned non-%s (type %.200s)",
+ "__%.4s__ returned non-%.4s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
@@ -30811,34 +33808,31 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
- PyObject* x = PyNumber_Index(b);
+ PyObject *x;
+#if PY_MAJOR_VERSION < 3
+ if (likely(PyInt_CheckExact(b)))
+ return PyInt_AS_LONG(b);
+#endif
+ if (likely(PyLong_CheckExact(b))) {
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
+ #if CYTHON_USE_PYLONG_INTERNALS
+ switch (Py_SIZE(b)) {
+ case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
+ case 0: return 0;
+ case 1: return ((PyLongObject*)b)->ob_digit[0];
+ }
+ #endif
+ #endif
+ return PyLong_AsSsize_t(b);
+ }
+ x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
-#if PY_VERSION_HEX < 0x02050000
- if (ival <= LONG_MAX)
- return PyInt_FromLong((long)ival);
- else {
- unsigned char *bytes = (unsigned char *) &ival;
- int one = 1; int little = (int)*(unsigned char*)&one;
- return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
- }
-#else
- return PyInt_FromSize_t(ival);
-#endif
-}
-static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
- unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
- if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
- if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
- PyErr_SetString(PyExc_OverflowError,
- "value too large to convert to size_t");
- return (size_t)-1;
- }
- return (size_t)val;
+ return PyInt_FromSize_t(ival);
}
diff --git a/python/cdec/_cdec.pyx b/python/cdec/_cdec.pyx
index 2e4265d4..2509c6cd 100644
--- a/python/cdec/_cdec.pyx
+++ b/python/cdec/_cdec.pyx
@@ -85,13 +85,13 @@ cdef class Decoder:
cdef variables_map* conf = &self.dec.GetConf()
return str(conf[0]['formalism'].as_str().c_str())
- def read_weights(self, weights):
+ def read_weights(self, weights, scaling = 1.0):
"""decoder.read_weights(filename): Read decoder weights from a file."""
with open(weights) as fp:
for line in fp:
if line.strip().startswith('#'): continue
fname, value = line.split()
- self.weights[fname.strip()] = float(value)
+ self.weights[fname.strip()] = float(value) * scaling
def translate(self, sentence, grammar=None):
"""decoder.translate(sentence, grammar=None) -> Hypergraph
diff --git a/python/cdec/hypergraph.pxi b/python/cdec/hypergraph.pxi
index 1e0a1903..16a68a00 100644
--- a/python/cdec/hypergraph.pxi
+++ b/python/cdec/hypergraph.pxi
@@ -152,6 +152,21 @@ cdef class Hypergraph:
yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8')
finally:
del hypos
+
+ def sample_hypotheses(self, unsigned n):
+ """hg.sample_string(n) -> Sample of n hypotheses from the hypergraph.
+ Generates (sample_string, dot, fmap)"""
+ cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]()
+ cdef SparseVector fmap = None
+ hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos)
+ cdef unsigned k
+ try:
+ for k in range(hypos.size()):
+ fmap = SparseVector.__new__(SparseVector)
+ fmap.vector = new FastSparseVector[weight_t](hypos[0][k].fmap)
+ yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8'), hypos[0][k].model_score.as_float(), fmap
+ finally:
+ del hypos
def sample_trees(self, unsigned n):
"""hg.sample_trees(n) -> Sample of n trees from the hypergraph."""
diff --git a/python/cdec/sa/_sa.cpp b/python/cdec/sa/_sa.cpp
index bbea8c9c..d3ffcda3 100644
--- a/python/cdec/sa/_sa.cpp
+++ b/python/cdec/sa/_sa.cpp
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.20.1 on Thu Apr 10 16:55:21 2014 */
+/* Generated by Cython 0.21 */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
@@ -16,11 +16,11 @@
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
-#elif PY_VERSION_HEX < 0x02040000
- #error Cython requires Python 2.4+.
+#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
+ #error Cython requires Python 2.6+ or Python 3.2+.
#else
-#define CYTHON_ABI "0_20_1"
-#include <stddef.h> /* For offsetof */
+#define CYTHON_ABI "0_21"
+#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
@@ -54,65 +54,11 @@
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
-#if CYTHON_COMPILING_IN_PYPY
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
-#if PY_VERSION_HEX < 0x02050000
- typedef int Py_ssize_t;
- #define PY_SSIZE_T_MAX INT_MAX
- #define PY_SSIZE_T_MIN INT_MIN
- #define PY_FORMAT_SIZE_T ""
- #define CYTHON_FORMAT_SSIZE_T ""
- #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
- #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
- #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
- (PyErr_Format(PyExc_TypeError, \
- "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
- (PyObject*)0))
- #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
- !PyComplex_Check(o))
- #define PyIndex_Check __Pyx_PyIndex_Check
- #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
- #define __PYX_BUILD_PY_SSIZE_T "i"
-#else
- #define __PYX_BUILD_PY_SSIZE_T "n"
- #define CYTHON_FORMAT_SSIZE_T "z"
- #define __Pyx_PyIndex_Check PyIndex_Check
-#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
- #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
- #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
- #define PyVarObject_HEAD_INIT(type, size) \
- PyObject_HEAD_INIT(type) size,
- #define PyType_Modified(t)
- typedef struct {
- void *buf;
- PyObject *obj;
- Py_ssize_t len;
- Py_ssize_t itemsize;
- int readonly;
- int ndim;
- char *format;
- Py_ssize_t *shape;
- Py_ssize_t *strides;
- Py_ssize_t *suboffsets;
- void *internal;
- } Py_buffer;
- #define PyBUF_SIMPLE 0
- #define PyBUF_WRITABLE 0x0001
- #define PyBUF_FORMAT 0x0004
- #define PyBUF_ND 0x0008
- #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
- #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
- #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
- #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
- #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
- #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
- #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
- typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
- typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
-#endif
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
@@ -124,22 +70,13 @@
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyType_Type
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
-#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
-#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define Py_TPFLAGS_HAVE_VERSION_TAG 0
-#endif
-#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
- #define Py_TPFLAGS_IS_ABSTRACT 0
-#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
#define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
@@ -169,7 +106,7 @@
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
-#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
@@ -183,36 +120,13 @@
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PyBytesObject PyStringObject
- #define PyBytes_Type PyString_Type
- #define PyBytes_Check PyString_Check
- #define PyBytes_CheckExact PyString_CheckExact
- #define PyBytes_FromString PyString_FromString
- #define PyBytes_FromStringAndSize PyString_FromStringAndSize
- #define PyBytes_FromFormat PyString_FromFormat
- #define PyBytes_DecodeEscape PyString_DecodeEscape
- #define PyBytes_AsString PyString_AsString
- #define PyBytes_AsStringAndSize PyString_AsStringAndSize
- #define PyBytes_Size PyString_Size
- #define PyBytes_AS_STRING PyString_AS_STRING
- #define PyBytes_GET_SIZE PyString_GET_SIZE
- #define PyBytes_Repr PyString_Repr
- #define PyBytes_Concat PyString_Concat
- #define PyBytes_ConcatAndDel PyString_ConcatAndDel
-#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
- #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
- PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
-#if PY_VERSION_HEX < 0x02060000
- #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
- #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
-#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
@@ -245,43 +159,9 @@
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
-#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
- #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
- #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
-#else
- #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
- #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
-#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
-#else
- #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
- #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
- #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
-#endif
-#if PY_VERSION_HEX < 0x02050000
- #define __Pyx_NAMESTR(n) ((char *)(n))
- #define __Pyx_DOCSTR(n) ((char *)(n))
-#else
- #define __Pyx_NAMESTR(n) (n)
- #define __Pyx_DOCSTR(n) (n)
-#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
@@ -316,6 +196,12 @@ static CYTHON_INLINE float __PYX_NAN() {
return value;
}
#endif
+#ifdef __cplusplus
+template<typename T>
+void __Pyx_call_destructor(T* x) {
+ x->~T();
+}
+#endif
#if PY_MAJOR_VERSION >= 3
@@ -367,7 +253,7 @@ static CYTHON_INLINE float __PYX_NAN() {
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
- const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
@@ -390,7 +276,7 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t*
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
@@ -400,17 +286,17 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#endif
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
-#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
-#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
-#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s)
-#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
-#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
+#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
const Py_UNICODE *u_end = u;
while (*u_end++) ;
- return u_end - u - 1;
+ return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
@@ -433,18 +319,21 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
- PyObject* sys = NULL;
+ PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
- if (default_encoding == NULL) goto bad;
- if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
- const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
@@ -452,23 +341,21 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) {
}
__Pyx_sys_getdefaultencoding_not_ascii = 1;
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
- if (ascii_chars_u == NULL) goto bad;
+ if (!ascii_chars_u) goto bad;
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
- if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
PyErr_Format(
PyExc_ValueError,
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
default_encoding_c);
goto bad;
}
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
}
- Py_XDECREF(sys);
- Py_XDECREF(default_encoding);
- Py_XDECREF(ascii_chars_u);
- Py_XDECREF(ascii_chars_b);
+ Py_DECREF(default_encoding);
return 0;
bad:
- Py_XDECREF(sys);
Py_XDECREF(default_encoding);
Py_XDECREF(ascii_chars_u);
Py_XDECREF(ascii_chars_b);
@@ -482,21 +369,22 @@ bad:
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
- PyObject* sys = NULL;
+ PyObject* sys;
PyObject* default_encoding = NULL;
char* default_encoding_c;
sys = PyImport_ImportModule("sys");
- if (sys == NULL) goto bad;
+ if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
- if (default_encoding == NULL) goto bad;
- default_encoding_c = PyBytes_AS_STRING(default_encoding);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
- Py_DECREF(sys);
Py_DECREF(default_encoding);
return 0;
bad:
- Py_XDECREF(sys);
Py_XDECREF(default_encoding);
return -1;
}
@@ -504,16 +392,11 @@ bad:
#endif
-#ifdef __GNUC__
- /* Test for GCC > 2.95 */
- #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else /* __GNUC__ > 2 ... */
- #define likely(x) (x)
- #define unlikely(x) (x)
- #endif /* __GNUC__ > 2 ... */
-#else /* __GNUC__ */
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
@@ -530,21 +413,21 @@ static const char *__pyx_filename;
static const char *__pyx_f[] = {
- "_sa.pyx",
- "float_list.pxi",
- "int_list.pxi",
- "data_array.pxi",
- "alignment.pxi",
- "bilex.pxi",
- "veb.pxi",
- "rule.pxi",
- "rulefactory.pxi",
- "lcp.pxi",
- "sym.pxi",
- "precomputation.pxi",
- "suffix_array.pxi",
- "features.pxi",
- "str_map.pxi",
+ "cdec/sa/_sa.pyx",
+ "cdec/sa/float_list.pxi",
+ "cdec/sa/int_list.pxi",
+ "cdec/sa/data_array.pxi",
+ "cdec/sa/alignment.pxi",
+ "cdec/sa/bilex.pxi",
+ "cdec/sa/veb.pxi",
+ "cdec/sa/rule.pxi",
+ "cdec/sa/rulefactory.pxi",
+ "cdec/sa/lcp.pxi",
+ "cdec/sa/sym.pxi",
+ "cdec/sa/precomputation.pxi",
+ "cdec/sa/suffix_array.pxi",
+ "cdec/sa/features.pxi",
+ "cdec/sa/str_map.pxi",
};
/*--- Type declarations ---*/
@@ -590,20 +473,21 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr;
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words;
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr;
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__;
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__;
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr;
struct __pyx_t_4cdec_2sa_3_sa__node;
struct __pyx_t_4cdec_2sa_3_sa__BitSet;
struct __pyx_t_4cdec_2sa_3_sa__VEB;
@@ -612,7 +496,7 @@ struct __pyx_t_4cdec_2sa_3_sa__Trie_Node;
struct __pyx_t_4cdec_2sa_3_sa_match_node;
struct __pyx_t_4cdec_2sa_3_sa_Matching;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":9
+/* "cdec/sa/bilex.pxi":9
* from libc.string cimport memset, strcpy
*
* cdef struct _node: # <<<<<<<<<<<<<<
@@ -626,7 +510,7 @@ struct __pyx_t_4cdec_2sa_3_sa__node {
int val;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":30
+/* "cdec/sa/veb.pxi":30
* _init_lower_mask()
*
* cdef struct _BitSet: # <<<<<<<<<<<<<<
@@ -640,7 +524,7 @@ struct __pyx_t_4cdec_2sa_3_sa__BitSet {
int size;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":168
+/* "cdec/sa/veb.pxi":168
* return result
*
* cdef struct _VEB: # <<<<<<<<<<<<<<
@@ -657,7 +541,7 @@ struct __pyx_t_4cdec_2sa_3_sa__VEB {
void **bottom;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":10
+/* "cdec/sa/precomputation.pxi":10
* cdef struct _Trie_Node # forward decl
*
* cdef struct _Trie_Edge: # <<<<<<<<<<<<<<
@@ -671,7 +555,7 @@ struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge {
struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *smaller;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":8
+/* "cdec/sa/precomputation.pxi":8
* from libc.string cimport memset, memcpy
*
* cdef struct _Trie_Node # forward decl # <<<<<<<<<<<<<<
@@ -684,7 +568,7 @@ struct __pyx_t_4cdec_2sa_3_sa__Trie_Node {
int arr_len;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":97
+/* "cdec/sa/rulefactory.pxi":97
*
* # linked list structure for storing matches in BaselineRuleFactory
* cdef struct match_node: # <<<<<<<<<<<<<<
@@ -696,7 +580,7 @@ struct __pyx_t_4cdec_2sa_3_sa_match_node {
struct __pyx_t_4cdec_2sa_3_sa_match_node *next;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":193
+/* "cdec/sa/rulefactory.pxi":193
*
* # struct used to encapsulate a single matching
* cdef struct Matching: # <<<<<<<<<<<<<<
@@ -764,7 +648,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector {
*
* cdef class Phrase: # <<<<<<<<<<<<<<
* cdef int *syms
- * cdef int n, *varpos, n_vars
+ * cdef int n,
*/
struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
PyObject_HEAD
@@ -772,11 +656,11 @@ struct __pyx_obj_4cdec_2sa_3_sa_Phrase {
int *syms;
int n;
int *varpos;
- int n_vars;
+ PyObject *n_vars;
};
-/* "cdec/sa/_sa.pxd":35
+/* "cdec/sa/_sa.pxd":37
* cdef public int chunklen(self, int k)
*
* cdef class Rule: # <<<<<<<<<<<<<<
@@ -794,7 +678,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":8
+/* "cdec/sa/str_map.pxi":8
* char* stringmap_word(StrMap *vocab, int i)
*
* cdef class StringMap: # <<<<<<<<<<<<<<
@@ -808,7 +692,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_StringMap {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":9
+/* "cdec/sa/data_array.pxi":9
* from libc.string cimport memset, strcpy
*
* cdef class DataArray: # <<<<<<<<<<<<<<
@@ -827,7 +711,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_DataArray {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":10
+/* "cdec/sa/alignment.pxi":10
* cdef int ALIGNMENT_CODE = 1 << 16
*
* cdef class Alignment: # <<<<<<<<<<<<<<
@@ -842,7 +726,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Alignment {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":47
+/* "cdec/sa/bilex.pxi":47
*
*
* cdef class BiLex: # <<<<<<<<<<<<<<
@@ -863,7 +747,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_BiLex {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":100
+/* "cdec/sa/veb.pxi":100
*
*
* cdef class BitSetIterator: # <<<<<<<<<<<<<<
@@ -877,7 +761,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":118
+/* "cdec/sa/veb.pxi":118
* # (entirely C-implemented) _BitSet struct.
* # Very slow; use only for debugging
* cdef class BitSet: # <<<<<<<<<<<<<<
@@ -890,7 +774,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_BitSet {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":340
+/* "cdec/sa/veb.pxi":340
*
*
* cdef class VEBIterator: # <<<<<<<<<<<<<<
@@ -904,7 +788,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":354
+/* "cdec/sa/veb.pxi":354
*
*
* cdef class VEB: # <<<<<<<<<<<<<<
@@ -918,7 +802,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_VEB {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":5
+/* "cdec/sa/lcp.pxi":5
* as k most frequent n-grams"""
*
* cdef class LCP: # <<<<<<<<<<<<<<
@@ -932,7 +816,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_LCP {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":7
+/* "cdec/sa/sym.pxi":7
* cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1
*
* cdef class Alphabet: # <<<<<<<<<<<<<<
@@ -950,7 +834,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Alphabet {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":109
+/* "cdec/sa/precomputation.pxi":109
* trie_node_to_map(edge.node, result, prefix, include_zeros)
*
* cdef class TrieMap: # <<<<<<<<<<<<<<
@@ -965,7 +849,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_TrieMap {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":188
+/* "cdec/sa/precomputation.pxi":188
*
*
* cdef class Precomputation: # <<<<<<<<<<<<<<
@@ -986,7 +870,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Precomputation {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":6
+/* "cdec/sa/suffix_array.pxi":6
* from libc.stdio cimport FILE, fclose, fopen
*
* cdef class SuffixArray: # <<<<<<<<<<<<<<
@@ -1002,7 +886,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":39
+/* "cdec/sa/rulefactory.pxi":39
* ])
*
* cdef class OnlineStats: # <<<<<<<<<<<<<<
@@ -1020,7 +904,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":67
+/* "cdec/sa/rulefactory.pxi":67
* cdef int EPSILON = sym_fromstring('*EPS*', True)
*
* cdef class TrieNode: # <<<<<<<<<<<<<<
@@ -1033,7 +917,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_TrieNode {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":73
+/* "cdec/sa/rulefactory.pxi":73
* self.children = {}
*
* cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<<
@@ -1048,7 +932,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":84
+/* "cdec/sa/rulefactory.pxi":84
*
*
* cdef class TrieTable: # <<<<<<<<<<<<<<
@@ -1063,7 +947,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_TrieTable {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":105
+/* "cdec/sa/rulefactory.pxi":105
* # in the suffix array; if discontiguous, it is the set of
* # actual locations (packed into an array)
* cdef class PhraseLocation: # <<<<<<<<<<<<<<
@@ -1082,7 +966,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":127
+/* "cdec/sa/rulefactory.pxi":127
*
*
* cdef class Sampler: # <<<<<<<<<<<<<<
@@ -1096,7 +980,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Sampler {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":249
+/* "cdec/sa/rulefactory.pxi":249
*
*
* cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<<
@@ -1149,7 +1033,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":23
+/* "cdec/sa/features.pxi":23
* return ' '.join('%s=%s' % feat for feat in self)
*
* cdef class Scorer: # <<<<<<<<<<<<<<
@@ -1163,7 +1047,7 @@ struct __pyx_obj_4cdec_2sa_3_sa_Scorer {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81
+/* "cdec/sa/int_list.pxi":81
* free(self.arr)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -1179,7 +1063,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72
+/* "cdec/sa/data_array.pxi":72
* self.read_text_data(fp)
*
* def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<<
@@ -1193,7 +1077,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":74
+/* "cdec/sa/data_array.pxi":74
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp:
* data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<<
@@ -1210,7 +1094,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36
+/* "cdec/sa/lcp.pxi":36
* logger.info("LCP array completed")
*
* def compute_stats(self, int max_n): # <<<<<<<<<<<<<<
@@ -1241,7 +1125,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+/* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -1255,7 +1139,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111
+/* "cdec/sa/sym.pxi":111
*
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -1272,7 +1156,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":112
+/* "cdec/sa/sym.pxi":112
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words)
* return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<<
@@ -1289,7 +1173,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+/* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -1302,7 +1186,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
+/* "cdec/sa/sym.pxi":115
*
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
@@ -1329,7 +1213,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+/* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -1342,7 +1226,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119
+/* "cdec/sa/sym.pxi":119
*
* def decode_sentence(lattice):
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<<
@@ -1360,7 +1244,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+/* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -1373,7 +1257,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122
+/* "cdec/sa/sym.pxi":122
*
* def encode_words(words):
* return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -1390,7 +1274,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+/* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -1402,7 +1286,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125
+/* "cdec/sa/sym.pxi":125
*
* def decode_words(syms):
* return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<<
@@ -1417,7 +1301,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140
+/* "cdec/sa/rule.pxi":140
* return self.syms[i]
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -1432,29 +1316,49 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182
+/* "cdec/sa/rule.pxi":158
+ * return [sym_tostring(w) for w in self if not sym_isvar(w)]
+ *
+ * def iterspans(self, nt_flag = False, to_str = True): # <<<<<<<<<<<<<<
+ * """iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)
+ * Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ */
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans {
+ PyObject_HEAD
+ PyObject *__pyx_v_get_sym;
+ int __pyx_v_i;
+ PyObject *__pyx_v_nt_flag;
+ int __pyx_v_s;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self;
+ PyObject *__pyx_v_span;
+ PyObject *__pyx_v_to_str;
+ int __pyx_t_0;
+};
+
+
+/* "cdec/sa/rule.pxi":201
* return self.f.arity()
*
* def __str__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)]
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ {
PyObject_HEAD
struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186
+/* "cdec/sa/rule.pxi":205
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)]
* if self.word_alignments is not None:
* fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<<
* return ' ||| '.join(fields)
*
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr {
PyObject_HEAD
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *__pyx_outer_scope;
PyObject *__pyx_v_a;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
@@ -1462,14 +1366,14 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189
+/* "cdec/sa/rule.pxi":208
* return ' ||| '.join(fields)
*
* def alignments(self): # <<<<<<<<<<<<<<
* for point in self.word_alignments:
* yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments {
PyObject_HEAD
PyObject *__pyx_v_point;
struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self;
@@ -1479,14 +1383,14 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":981
+/* "cdec/sa/rulefactory.pxi":981
* return sorted(result);
*
* def input(self, fwords, meta, ctx_name=None): # <<<<<<<<<<<<<<
* '''When this function is called on the RuleFactory,
* it looks up all of the rules that can be used to translate
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input {
PyObject_HEAD
PyObject *__pyx_v_alignment;
PyObject *__pyx_v_als;
@@ -1561,10 +1465,10 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input {
PyObject *__pyx_v_xcat_index;
PyObject *__pyx_v_xnode;
PyObject *__pyx_v_xroot;
- Py_ssize_t __pyx_t_0;
+ PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
- int __pyx_t_2;
- PyObject *__pyx_t_3;
+ Py_ssize_t __pyx_t_2;
+ int __pyx_t_3;
PyObject *__pyx_t_4;
PyObject *__pyx_t_5;
int __pyx_t_6;
@@ -1576,16 +1480,16 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196
+/* "cdec/sa/rulefactory.pxi":1196
* if self.online:
* stats = self.online_stats[ctx_name]
* f_syms = tuple(word[0][0] for word in fwords) # <<<<<<<<<<<<<<
* for f, lex_i, lex_j in self.get_f_phrases(f_syms):
* spanlen = (lex_j - lex_i) + 1
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr {
PyObject_HEAD
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *__pyx_outer_scope;
PyObject *__pyx_v_word;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
@@ -1593,14 +1497,14 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1894
+/* "cdec/sa/rulefactory.pxi":1906
* # Aggregate stats from a training instance
* # (Extract rules, update counts)
* def add_instance(self, f_words, e_words, alignment, ctx_name=None): # <<<<<<<<<<<<<<
*
* self.online = True
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance {
PyObject_HEAD
PyObject *__pyx_v_al;
PyObject *__pyx_v_cover;
@@ -1616,30 +1520,30 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
+/* "cdec/sa/rulefactory.pxi":2073
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
*
* # Substitute in non-terminals
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule {
PyObject_HEAD
PyObject *__pyx_v_links;
struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122
+/* "cdec/sa/rulefactory.pxi":2134
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
* return (f, e, a, lex_f_i, lex_f_j)
*
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr {
PyObject_HEAD
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *__pyx_outer_scope;
PyObject *__pyx_v_i;
PyObject *__pyx_v_j;
PyObject *__pyx_t_0;
@@ -1647,30 +1551,30 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
+/* "cdec/sa/rulefactory.pxi":2138
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a)
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str)
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule {
PyObject_HEAD
PyObject *__pyx_v_a;
struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2127
+/* "cdec/sa/rulefactory.pxi":2139
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str)
*
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr {
PyObject_HEAD
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *__pyx_outer_scope;
PyObject *__pyx_v_packed;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
@@ -1678,14 +1582,14 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+/* "cdec/sa/rulefactory.pxi":2157
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
*
* f_len = len(f_words)
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases {
PyObject_HEAD
PyObject *__pyx_v_extract;
Py_ssize_t __pyx_v_f_len;
@@ -1695,14 +1599,14 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":15
+/* "cdec/sa/features.pxi":15
* self.values.append(value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
* cdef unsigned i
* for i in range(self.names.len):
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ {
PyObject_HEAD
unsigned int __pyx_v_i;
struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self;
@@ -1711,29 +1615,29 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ {
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":20
+/* "cdec/sa/features.pxi":20
* yield (FD.word(self.names[i]), self.values[i])
*
* def __str__(self): # <<<<<<<<<<<<<<
* return ' '.join('%s=%s' % feat for feat in self)
*
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ {
PyObject_HEAD
struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self;
};
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":21
+/* "cdec/sa/features.pxi":21
*
* def __str__(self):
* return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<<
*
* cdef class Scorer:
*/
-struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr {
+struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr {
PyObject_HEAD
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *__pyx_outer_scope;
PyObject *__pyx_v_feat;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
@@ -1742,7 +1646,7 @@ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr {
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":9
+/* "cdec/sa/float_list.pxi":9
* from libc.string cimport memset, strcpy, strlen
*
* cdef class FloatList: # <<<<<<<<<<<<<<
@@ -1770,7 +1674,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtabptr_4cdec_2sa_3_sa_IntList;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":4
+/* "cdec/sa/rule.pxi":4
* from libc.string cimport strsep, strcpy, strlen
*
* cdef class Phrase: # <<<<<<<<<<<<<<
@@ -1785,7 +1689,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;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":8
+/* "cdec/sa/str_map.pxi":8
* char* stringmap_word(StrMap *vocab, int i)
*
* cdef class StringMap: # <<<<<<<<<<<<<<
@@ -1800,7 +1704,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *__pyx_vtabptr_4cdec_2sa_3_sa_StringMap;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":9
+/* "cdec/sa/data_array.pxi":9
* from libc.string cimport memset, strcpy
*
* cdef class DataArray: # <<<<<<<<<<<<<<
@@ -1815,7 +1719,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *__pyx_vtabptr_4cdec_2sa_3_sa_DataArray;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":10
+/* "cdec/sa/alignment.pxi":10
* cdef int ALIGNMENT_CODE = 1 << 16
*
* cdef class Alignment: # <<<<<<<<<<<<<<
@@ -1831,7 +1735,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *__pyx_vtabptr_4cdec_2sa_3_sa_Alignment;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":47
+/* "cdec/sa/bilex.pxi":47
*
*
* cdef class BiLex: # <<<<<<<<<<<<<<
@@ -1850,7 +1754,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *__pyx_vtabptr_4cdec_2sa_3_sa_BiLex;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":354
+/* "cdec/sa/veb.pxi":354
*
*
* cdef class VEB: # <<<<<<<<<<<<<<
@@ -1866,7 +1770,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *__pyx_vtabptr_4cdec_2sa_3_sa_VEB;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":7
+/* "cdec/sa/sym.pxi":7
* cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1
*
* cdef class Alphabet: # <<<<<<<<<<<<<<
@@ -1889,7 +1793,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *__pyx_vtabptr_4cdec_2sa_3_sa_Alphabet;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":109
+/* "cdec/sa/precomputation.pxi":109
* trie_node_to_map(edge.node, result, prefix, include_zeros)
*
* cdef class TrieMap: # <<<<<<<<<<<<<<
@@ -1904,7 +1808,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *__pyx_vtabptr_4cdec_2sa_3_sa_TrieMap;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":188
+/* "cdec/sa/precomputation.pxi":188
*
*
* cdef class Precomputation: # <<<<<<<<<<<<<<
@@ -1919,7 +1823,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *__pyx_vtabptr_4cdec_2sa_3_sa_Precomputation;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":6
+/* "cdec/sa/suffix_array.pxi":6
* from libc.stdio cimport FILE, fclose, fopen
*
* cdef class SuffixArray: # <<<<<<<<<<<<<<
@@ -1936,7 +1840,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *__pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":105
+/* "cdec/sa/rulefactory.pxi":105
* # in the suffix array; if discontiguous, it is the set of
* # actual locations (packed into an array)
* cdef class PhraseLocation: # <<<<<<<<<<<<<<
@@ -1950,7 +1854,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation *__pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":249
+/* "cdec/sa/rulefactory.pxi":249
*
*
* cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<<
@@ -1978,7 +1882,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory {
static struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory;
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":23
+/* "cdec/sa/features.pxi":23
* return ' '.join('%s=%s' % feat for feat in self)
*
* cdef class Scorer: # <<<<<<<<<<<<<<
@@ -2003,7 +1907,7 @@ static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *__pyx_vtabptr_4cdec_2sa_3_
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
- static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
@@ -2040,7 +1944,7 @@ static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *__pyx_vtabptr_4cdec_2sa_3_
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
-#endif /* CYTHON_REFNANNY */
+#endif
#define __Pyx_XDECREF_SET(r, v) do { \
PyObject *tmp = (PyObject *) r; \
r = v; __Pyx_XDECREF(tmp); \
@@ -2067,16 +1971,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif
-static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
-static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
+static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
Py_ssize_t end, int direction)
{
@@ -2085,10 +1995,8 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
const char* sub_ptr;
Py_ssize_t sub_len;
int retval;
-#if PY_VERSION_HEX >= 0x02060000
Py_buffer view;
view.obj = NULL;
-#endif
if ( PyBytes_Check(arg) ) {
sub_ptr = PyBytes_AS_STRING(arg);
sub_len = PyBytes_GET_SIZE(arg);
@@ -2099,15 +2007,10 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
}
#endif
else {
-#if PY_VERSION_HEX < 0x02060000
- if (unlikely(PyObject_AsCharBuffer(arg, &sub_ptr, &sub_len)))
- return -1;
-#else
if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
return -1;
sub_ptr = (const char*) view.buf;
sub_len = view.len;
-#endif
}
if (end > self_len)
end = self_len;
@@ -2124,13 +2027,11 @@ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize
start = end - sub_len;
}
if (start + sub_len <= end)
- retval = !memcmp(self_ptr+start, sub_ptr, sub_len);
+ retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len);
else
retval = 0;
-#if PY_VERSION_HEX >= 0x02060000
if (view.obj)
PyBuffer_Release(&view);
-#endif
return retval;
}
static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start,
@@ -2158,33 +2059,33 @@ static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t
return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
}
-static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
- const char* function_name); /*proto*/
+ const char* function_name);
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
- Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
static void __Pyx_WriteUnraisable(const char *name, int clineno,
int lineno, const char *filename,
- int full_traceback); /*proto*/
+ int full_traceback);
-static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
-static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/
+static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
#include <string.h>
-static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
-static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
@@ -2234,29 +2135,11 @@ static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq
return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}
-static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
- PyObject *method, *result = NULL;
- if (unlikely(!args)) return NULL;
- method = __Pyx_PyObject_GetAttrStr(obj, method_name);
- if (unlikely(!method)) goto bad;
- result = __Pyx_PyObject_Call(method, args, NULL);
- Py_DECREF(method);
-bad:
- Py_DECREF(args);
- return result;
-}
-#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
-#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
-#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
- __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
-#define __Pyx_PyObject_CallMethod0(obj, name) \
- __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
-static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/
+static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
-#if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX >= 0x03020000 || PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
PyObject *res;
PyTypeObject *tp = Py_TYPE(obj);
@@ -2281,10 +2164,16 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif
-static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+#else
+#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
+#endif
-static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
+static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
+
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
@@ -2307,9 +2196,9 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+static CYTHON_INLINE int __Pyx_IterFinish(void);
-static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
@@ -2320,7 +2209,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
int is_list, int wraparound, int boundscheck);
-static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
+static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj) \
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
@@ -2337,7 +2226,7 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
- const char *name, int exact); /*proto*/
+ const char *name, int exact);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
@@ -2394,56 +2283,9 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
#define __Pyx_PyBytes_Join _PyBytes_Join
#endif
#else
-static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
-
-static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
-
-static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
- int is_tuple, int has_known_size, int decref_tuple);
-
-static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
- Py_ssize_t* p_orig_length, int* p_is_dict);
-static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
- PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
-
-#if PY_VERSION_HEX < 0x02050000
-#ifndef PyAnySet_CheckExact
-#define PyAnySet_CheckExact(ob) \
- ((ob)->ob_type == &PySet_Type || \
- (ob)->ob_type == &PyFrozenSet_Type)
-#define PySet_New(iterable) \
- PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)
-#define Pyx_PyFrozenSet_New(iterable) \
- PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)
-#define PySet_Size(anyset) \
- PyObject_Size((anyset))
-#define PySet_Contains(anyset, key) \
- PySequence_Contains((anyset), (key))
-#define PySet_Pop(set) \
- PyObject_CallMethod((set), (char*)"pop", NULL)
-static CYTHON_INLINE int PySet_Clear(PyObject *set) {
- PyObject *ret = PyObject_CallMethod(set, (char*)"clear", NULL);
- if (!ret) return -1;
- Py_DECREF(ret); return 0;
-}
-static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
- PyObject *ret = PyObject_CallMethod(set, (char*)"discard", (char*)"(O)", key);
- if (!ret) return -1;
- Py_DECREF(ret); return 0;
-}
-static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
- PyObject *ret = PyObject_CallMethod(set, (char*)"add", (char*)"(O)", key);
- if (!ret) return -1;
- Py_DECREF(ret); return 0;
-}
-#endif /* PyAnySet_CheckExact (<= Py2.4) */
-#endif /* < Py2.5 */
-
-static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */
-
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
#define __Pyx_CyFunction_USED 1
@@ -2461,22 +2303,24 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
- PyObject *func_dict;
+#if PY_VERSION_HEX < 0x030500A0
PyObject *func_weakreflist;
+#endif
+ PyObject *func_dict;
PyObject *func_name;
PyObject *func_qualname;
PyObject *func_doc;
PyObject *func_globals;
PyObject *func_code;
PyObject *func_closure;
- PyObject *func_classobj; /* No-args super() class cell */
+ PyObject *func_classobj;
void *defaults;
int defaults_pyobjects;
int flags;
- PyObject *defaults_tuple; /* Const defaults tuple */
- PyObject *defaults_kwdict; /* Const kwonly defaults dict */
+ PyObject *defaults_tuple;
+ PyObject *defaults_kwdict;
PyObject *(*defaults_getter)(PyObject *);
- PyObject *func_annotations; /* function annotations dict */
+ PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
@@ -2497,6 +2341,22 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
PyObject *dict);
static int __Pyx_CyFunction_init(void);
+static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
+
+static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
+ int is_tuple, int has_known_size, int decref_tuple);
+
+static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
+ Py_ssize_t* p_orig_length, int* p_is_dict);
+static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
+ PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
+
+static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */
+
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject* none = _PyList_Extend((PyListObject*)L, v);
@@ -2511,23 +2371,44 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#define __Pyx_PyObject_Pop(L) (PyList_CheckExact(L) ? \
__Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
-static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/
-static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L); /*proto*/
+static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L);
+static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L);
-#define __Pyx_PyObject_PopIndex(L, ix) (PyList_CheckExact(L) ? \
- __Pyx_PyList_PopIndex(L, ix) : __Pyx__PyObject_PopIndex(L, ix))
-static PyObject* __Pyx_PyList_PopIndex(PyObject* L, Py_ssize_t ix); /*proto*/
-static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, Py_ssize_t ix); /*proto*/
+#define __Pyx_PyObject_PopIndex(L, ix, is_signed, type, to_py_func) ( \
+ (PyList_CheckExact(L) && __Pyx_fits_Py_ssize_t(ix, type, is_signed)) ? \
+ __Pyx__PyList_PopIndex(L, ix) : __Pyx__PyObject_PopIndex(L, to_py_func(ix)))
+#define __Pyx_PyList_PopIndex(L, ix, is_signed, type, to_py_func) ( \
+ __Pyx_fits_Py_ssize_t(ix, type, is_signed) ? \
+ __Pyx__PyList_PopIndex(L, ix) : __Pyx__PyObject_PopIndex(L, to_py_func(ix)))
+static PyObject* __Pyx__PyList_PopIndex(PyObject* L, Py_ssize_t ix);
+static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix);
-static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable);
-static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+typedef struct {
+ int code_line;
+ PyCodeObject* code_object;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
@@ -2537,7 +2418,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
-static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_Generator_USED
#include <structmember.h>
@@ -2553,11 +2434,13 @@ typedef struct {
PyObject *gi_weakreflist;
PyObject *classobj;
PyObject *yieldfrom;
+ PyObject *gi_name;
+ PyObject *gi_qualname;
int resume_label;
char is_running;
} __pyx_GeneratorObject;
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure);
+ PyObject *closure, PyObject *name, PyObject *qualname);
static int __pyx_Generator_init(void);
static int __Pyx_Generator_clear(PyObject* self);
#if 1 || PY_VERSION_HEX < 0x030300B0
@@ -2568,27 +2451,73 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
static int __Pyx_check_binary_version(void);
-static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/
-
-typedef struct {
- int code_line;
- PyCodeObject* code_object;
-} __Pyx_CodeObjectCacheEntry;
-struct __Pyx_CodeObjectCache {
- int count;
- int max_count;
- __Pyx_CodeObjectCacheEntry* entries;
-};
-static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
-static PyCodeObject *__pyx_find_code_object(int code_line);
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
-
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename); /*proto*/
-
-static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
-
+static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, int __pyx_v_i, float __pyx_v_v); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_i, int __pyx_v_val); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_other); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int *__pyx_v_other, int __pyx_v_other_len); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList_write_handle(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static char *__pyx_f_4cdec_2sa_3_sa_9StringMap_word(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self, int __pyx_v_i); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_9StringMap_index(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self, char *__pyx_v_s); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_i, int __pyx_v_j); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_link, int *__pyx_v_f, int *__pyx_v_e); /* proto*/
+static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id, int *__pyx_v_num_links); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsa, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_eda, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_aa); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n, int *__pyx_v_num_pairs, float __pyx_v_fmargin, int *__pyx_v_emargin); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_wordlist, FILE *__pyx_v_f); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_word2id, PyObject *__pyx_v_id2word, FILE *__pyx_v_f); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_pad); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_3VEB__insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_i); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_3VEB__findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_i); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym, int __pyx_v_ind); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_match(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym1, int __pyx_v_sym2); /* proto*/
+static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, char *__pyx_v_s); /* proto*/
+static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self, char *__pyx_v_s, int __pyx_v_terminal); /* proto*/
+int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k); /* proto*/
+int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k); /* proto*/
+static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap__insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len); /* proto*/
+static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap__contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_m, FILE *__pyx_v_f); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, FILE *__pyx_v_f); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high, int __pyx_v_midpoint); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, CYTHON_UNUSED int __pyx_v_sent_id); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_darray); /* proto*/
+static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_low1, int __pyx_v_high1, int *__pyx_v_arr1, int __pyx_v_step1, int __pyx_v_low2, int __pyx_v_high2, int *__pyx_v_arr2, int __pyx_v_step2, int __pyx_v_offset_by_one, int __pyx_v_len_last, int __pyx_v_num_subpatterns, int *__pyx_v_result_len); /* proto*/
+static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_i1_minus, int __pyx_v_i1_plus, int *__pyx_v_arr1, int __pyx_v_step1, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last); /* proto*/
+static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last); /* proto*/
+static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_low1, int __pyx_v_high1, int *__pyx_v_arr1, int __pyx_v_step1, int __pyx_v_low2, int __pyx_v_high2, int *__pyx_v_arr2, int __pyx_v_step2, int __pyx_v_offset_by_one, int __pyx_v_len_last, int __pyx_v_num_subpatterns, int *__pyx_v_result_len); /* proto*/
+static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_loc, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_phrase); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_prefix, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_suffix, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_prefix_loc, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_suffix_loc, int __pyx_v_algorithm); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_loc); /* proto*/
+static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_prefix_node, PyObject *__pyx_v_suffix_node, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_phrase); /* proto*/
+static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_f_low, PyObject *__pyx_v_f_high, int *__pyx_v_f_links_low, int *__pyx_v_f_links_high, int *__pyx_v_e_links_low, int *__pyx_v_e_links_high, int __pyx_v_e_in_low, int __pyx_v_e_in_high, int *__pyx_v_e_low, int *__pyx_v_e_high, int *__pyx_v_f_back_low, int *__pyx_v_f_back_high, int __pyx_v_f_sent_len, int __pyx_v_e_sent_len, int __pyx_v_max_f_len, int __pyx_v_max_e_len, int __pyx_v_min_fx_size, int __pyx_v_min_ex_size, int __pyx_v_max_new_x, int __pyx_v_allow_low_x, int __pyx_v_allow_high_x, int __pyx_v_allow_arbitrary_x, CYTHON_UNUSED int __pyx_v_write_log); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_in_low, int __pyx_v_in_high, int *__pyx_v_in_links_low, int *__pyx_v_in_links_high, int *__pyx_v_out_low, int *__pyx_v_out_high); /* proto*/
+static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_data, int __pyx_v_data_len); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrases(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int __pyx_v_e_low, int __pyx_v_e_high, int *__pyx_v_e_gap_low, int *__pyx_v_e_gap_high, int *__pyx_v_e_links_low, int __pyx_v_num_gaps, CYTHON_UNUSED int __pyx_v_f_low, CYTHON_UNUSED int __pyx_v_f_high, CYTHON_UNUSED int *__pyx_v_f_gap_low, CYTHON_UNUSED int *__pyx_v_f_gap_high, CYTHON_UNUSED int *__pyx_v_f_links_low, CYTHON_UNUSED int __pyx_v_sent_id, int __pyx_v_e_sent_len, int __pyx_v_e_sent_start); /* proto*/
+static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_create_alignments(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_sent_links, int __pyx_v_num_links, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_findexes, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_eindexes); /* proto*/
+static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_phrase, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_matching, int *__pyx_v_chunklen, int __pyx_v_num_chunks); /* proto*/
+static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Scorer_score(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_ctx); /* proto*/
/* Module declarations from 'libc.string' */
@@ -2641,20 +2570,21 @@ static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr =
static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = 0;
static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = 0;
static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_input = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = 0;
-static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_input = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ = 0;
+static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr = 0;
static int __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE;
static int __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE;
static int __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS;
@@ -2853,6 +2783,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_
static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_sym); /* proto */
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_33iterspans(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_nt_flag, PyObject *__pyx_v_to_str); /* proto */
static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments); /* proto */
static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */
#if PY_MAJOR_VERSION < 3
@@ -2883,8 +2816,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_word, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */
static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
@@ -2940,15 +2873,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_meta, PyObject *__pyx_v_ctx_name); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_min_bound, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words, PyObject *__pyx_v_e_words, PyObject *__pyx_v_alignment, PyObject *__pyx_v_ctx_name); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
-static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(PyObject *__pyx_self); /* proto */
@@ -3008,20 +2941,21 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyTyp
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_input(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_[] = ",";
static char __pyx_k_0[] = "0";
static char __pyx_k_1[] = "1";
@@ -3099,6 +3033,7 @@ static char __pyx_k_exit[] = "__exit__";
static char __pyx_k_gzip[] = "gzip";
static char __pyx_k_high[] = "high";
static char __pyx_k_info[] = "info";
+static char __pyx_k_iter[] = "__iter__";
static char __pyx_k_join[] = "join";
static char __pyx_k_link[] = "link";
static char __pyx_k_main[] = "__main__";
@@ -3128,6 +3063,7 @@ static char __pyx_k_eword[] = "eword";
static char __pyx_k_fword[] = "fword";
static char __pyx_k_ifrom[] = "ifrom";
static char __pyx_k_index[] = "index";
+static char __pyx_k_input[] = "input";
static char __pyx_k_isvar[] = "isvar";
static char __pyx_k_lex_i[] = "lex_i";
static char __pyx_k_lex_j[] = "lex_j";
@@ -3173,6 +3109,7 @@ static char __pyx_k_scorer[] = "scorer";
static char __pyx_k_scores[] = "scores";
static char __pyx_k_sorted[] = "sorted";
static char __pyx_k_source[] = "source";
+static char __pyx_k_to_str[] = "to_str";
static char __pyx_k_unlink[] = "unlink";
static char __pyx_k_update[] = "update";
static char __pyx_k_Counter[] = "Counter";
@@ -3196,6 +3133,7 @@ static char __pyx_k_logging[] = "logging";
static char __pyx_k_matches[] = "matches";
static char __pyx_k_new_e_i[] = "new_e_i";
static char __pyx_k_new_e_j[] = "new_e_j";
+static char __pyx_k_nt_flag[] = "nt_flag";
static char __pyx_k_nt_open[] = "nt_open";
static char __pyx_k_pathlen[] = "pathlen";
static char __pyx_k_sa_high[] = "sa_high";
@@ -3234,6 +3172,7 @@ static char __pyx_k_getLogger[] = "getLogger";
static char __pyx_k_getrusage[] = "getrusage";
static char __pyx_k_increment[] = "increment";
static char __pyx_k_iteritems[] = "iteritems";
+static char __pyx_k_iterspans[] = "iterspans";
static char __pyx_k_itertools[] = "itertools";
static char __pyx_k_min_bound[] = "min_bound";
static char __pyx_k_new_lex_i[] = "new_lex_i";
@@ -3289,8 +3228,10 @@ static char __pyx_k_gzip_or_text[] = "gzip_or_text";
static char __pyx_k_make_lattice[] = "make_lattice";
static char __pyx_k_min_gap_size[] = "min_gap_size";
static char __pyx_k_nt_collision[] = "nt_collision";
+static char __pyx_k_Phrase___iter[] = "Phrase.__iter__";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_alphabet_size[] = "alphabet_size";
+static char __pyx_k_compute_stats[] = "compute_stats";
static char __pyx_k_double_binary[] = "double binary";
static char __pyx_k_from_iterable[] = "from_iterable";
static char __pyx_k_fsample_count[] = "fsample_count";
@@ -3299,10 +3240,12 @@ static char __pyx_k_new_min_bound[] = "new_min_bound";
static char __pyx_k_test_sentence[] = "test_sentence";
static char __pyx_k_tight_phrases[] = "tight_phrases";
static char __pyx_k_FeatureContext[] = "FeatureContext";
+static char __pyx_k_IntList___iter[] = "IntList.__iter__";
static char __pyx_k_decode_lattice[] = "decode_lattice";
static char __pyx_k_pattern2phrase[] = "pattern2phrase";
static char __pyx_k_read_text_data[] = "read_text_data";
static char __pyx_k_Finalizing_sort[] = " Finalizing sort...";
+static char __pyx_k_Rule_alignments[] = "Rule.alignments";
static char __pyx_k_Unaligned_chunk[] = "Unaligned chunk";
static char __pyx_k_by_slack_factor[] = "by_slack_factor";
static char __pyx_k_decode_sentence[] = "decode_sentence";
@@ -3314,11 +3257,13 @@ static char __pyx_k_precompute_rank[] = "precompute_rank";
static char __pyx_k_use_baeza_yates[] = "use_baeza_yates";
static char __pyx_k_word_alignments[] = "word_alignments";
static char __pyx_k_INITIAL_CAPACITY[] = "INITIAL_CAPACITY";
+static char __pyx_k_Phrase_iterspans[] = "Phrase.iterspans";
static char __pyx_k_max_initial_size[] = "max_initial_size";
static char __pyx_k_max_nonterminals[] = "max_nonterminals";
static char __pyx_k_reachable_buffer[] = "reachable_buffer";
static char __pyx_k_s_not_in_IntList[] = "%s not in IntList";
static char __pyx_k_use_collocations[] = "use_collocations";
+static char __pyx_k_LCP_compute_stats[] = "LCP.compute_stats";
static char __pyx_k_max_target_chunks[] = "max_target_chunks";
static char __pyx_k_max_target_length[] = "max_target_length";
static char __pyx_k_online_ctx_lookup[] = "online_ctx_lookup";
@@ -3328,9 +3273,12 @@ static char __pyx_k_train_min_gap_size[] = "train_min_gap_size";
static char __pyx_k_LCP_array_completed[] = "LCP array completed";
static char __pyx_k_input_locals_lambda[] = "input.<locals>.<lambda>";
static char __pyx_k_pattern2phrase_plus[] = "pattern2phrase_plus";
+static char __pyx_k_FeatureVector___iter[] = "FeatureVector.__iter__";
static char __pyx_k_Invalid_LHS_symbol_d[] = "Invalid LHS symbol: %d";
static char __pyx_k_No_aligned_terminals[] = "No aligned terminals";
static char __pyx_k_OnlineFeatureContext[] = "OnlineFeatureContext";
+static char __pyx_k_input_locals_genexpr[] = "input.<locals>.genexpr";
+static char __pyx_k_str___locals_genexpr[] = "__str__.<locals>.genexpr";
static char __pyx_k_Refining_sort_depth_d[] = " Refining, sort depth = %d";
static char __pyx_k_cinit___locals_lambda[] = "__cinit__.<locals>.<lambda>";
static char __pyx_k_write_enhanced_handle[] = "write_enhanced_handle";
@@ -3339,8 +3287,11 @@ static char __pyx_k_Constructing_LCP_array[] = "Constructing LCP array";
static char __pyx_k_Extract_time_f_seconds[] = " Extract time = %f seconds";
static char __pyx_k_require_aligned_chunks[] = "require_aligned_chunks";
static char __pyx_k_train_max_initial_size[] = "train_max_initial_size";
+static char __pyx_k_fmt_rule_locals_genexpr[] = "fmt_rule.<locals>.genexpr";
static char __pyx_k_form_rule_locals_lambda[] = "form_rule.<locals>.<lambda>";
+static char __pyx_k_iterspans_locals_lambda[] = "iterspans.<locals>.<lambda>";
static char __pyx_k_Intersect_time_f_seconds[] = " Intersect time = %f seconds";
+static char __pyx_k_form_rule_locals_genexpr[] = "form_rule.<locals>.genexpr";
static char __pyx_k_require_aligned_terminal[] = "require_aligned_terminal";
static char __pyx_k_Refinement_took_f_seconds[] = " Refinement took %f seconds";
static char __pyx_k_get_all_nodes_isteps_away[] = "get_all_nodes_isteps_away";
@@ -3348,14 +3299,21 @@ static char __pyx_k_precompute_secondary_rank[] = "precompute_secondary_rank";
static char __pyx_k_Bucket_sort_took_f_seconds[] = " Bucket sort took %f seconds";
static char __pyx_k_Computing_inverted_indexes[] = " Computing inverted indexes...";
static char __pyx_k_Gaps_are_not_tight_phrases[] = "Gaps are not tight phrases";
+static char __pyx_k_read_bitext_locals_genexpr[] = "read_bitext.<locals>.genexpr";
static char __pyx_k_add_instance_locals_extract[] = "add_instance.<locals>.extract";
+static char __pyx_k_decode_words_locals_genexpr[] = "decode_words.<locals>.genexpr";
+static char __pyx_k_encode_words_locals_genexpr[] = "encode_words.<locals>.genexpr";
static char __pyx_k_get_precomputed_collocation[] = "get_precomputed_collocation";
+static char __pyx_k_make_lattice_locals_genexpr[] = "make_lattice.<locals>.genexpr";
static char __pyx_k_get_f_phrases_locals_extract[] = "get_f_phrases.<locals>.extract";
+static char __pyx_k_HieroCachingRuleFactory_input[] = "HieroCachingRuleFactory.input";
static char __pyx_k_Precomputation_took_f_seconds[] = "Precomputation took %f seconds";
static char __pyx_k_Sampling_strategy_no_sampling[] = "Sampling strategy: no sampling";
+static char __pyx_k_decode_lattice_locals_genexpr[] = "decode_lattice.<locals>.genexpr";
static char __pyx_k_Illegal_key_type_s_for_IntList[] = "Illegal key type %s for IntList";
static char __pyx_k_Unable_to_extract_basic_phrase[] = "Unable to extract basic phrase";
-static char __pyx_k_usr0_home_mdenkows_cdec_python[] = "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi";
+static char __pyx_k_Users_waziz_workspace_mtm14_my[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/sa/rulefactory.pxi";
+static char __pyx_k_decode_sentence_locals_genexpr[] = "decode_sentence.<locals>.genexpr";
static char __pyx_k_Processing_precomputations_took[] = "Processing precomputations took %f seconds";
static char __pyx_k_RANK_d_COUNT_COST_d_d_CUMUL_d_d[] = "RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d";
static char __pyx_k_Requested_index_d_d_of_d_length[] = "Requested index %d:%d of %d-length IntList";
@@ -3381,9 +3339,10 @@ static char __pyx_k_Subphrase_d_d_failed_integrity_c[] = "Subphrase [%d, %d] fai
static char __pyx_k_Suffix_array_construction_took_f[] = "Suffix array construction took %f seconds";
static char __pyx_k_Total_time_for_rule_lookup_extra[] = "Total time for rule lookup, extraction, and scoring = %f seconds";
static char __pyx_k_Unexpected_condition_found_in_q3[] = "Unexpected condition found in q3sort: sort from %d to %d";
+static char __pyx_k_Users_waziz_workspace_mtm14_my_2[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/sa/_sa.pyx";
+static char __pyx_k_Users_waziz_workspace_mtm14_my_3[] = "/Users/waziz/workspace/mtm14/my-cdec/python/cdec/sa/sym.pxi";
static char __pyx_k_input_locals_lambda_locals_lambd[] = "input.<locals>.<lambda>.<locals>.<lambda>";
-static char __pyx_k_usr0_home_mdenkows_cdec_python_2[] = "/usr0/home/mdenkows/cdec/python/cdec/sa/_sa.pyx";
-static char __pyx_k_usr0_home_mdenkows_cdec_python_3[] = "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi";
+static char __pyx_k_iterspans_locals_lambda_locals_l[] = "iterspans.<locals>.<lambda>.<locals>.<lambda>";
static char __pyx_k_Converting_d_hash_keys_on_precom_2[] = "Converting %d hash keys on precomputed collocations... ";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_kp_s_0;
@@ -3404,9 +3363,11 @@ static PyObject *__pyx_kp_s_ERROR_unexpected_pattern_s_in_se;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_kp_s_Extract_time_f_seconds;
static PyObject *__pyx_n_s_FeatureContext;
+static PyObject *__pyx_n_s_FeatureVector___iter;
static PyObject *__pyx_kp_s_Finalizing_sort;
static PyObject *__pyx_kp_s_Gaps_are_not_tight_phrases;
static PyObject *__pyx_n_s_GzipFile;
+static PyObject *__pyx_n_s_HieroCachingRuleFactory_input;
static PyObject *__pyx_n_s_INCREMENT;
static PyObject *__pyx_n_s_INITIAL_CAPACITY;
static PyObject *__pyx_kp_s_Illegal_key_type_s_for_IntList;
@@ -3414,14 +3375,18 @@ static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_s_Inside_edges_of_following_subphr;
static PyObject *__pyx_kp_s_Inside_edges_of_preceding_subphr;
static PyObject *__pyx_kp_s_IntList;
+static PyObject *__pyx_n_s_IntList___iter;
static PyObject *__pyx_kp_s_Intersect_time_f_seconds;
static PyObject *__pyx_kp_s_Invalid_LHS_symbol_d;
static PyObject *__pyx_kp_s_Keyword_trie_error;
static PyObject *__pyx_kp_s_LCP_array_completed;
+static PyObject *__pyx_n_s_LCP_compute_stats;
static PyObject *__pyx_kp_s_Must_specify_an_alignment_object;
static PyObject *__pyx_n_s_NULL;
static PyObject *__pyx_kp_s_No_aligned_terminals;
static PyObject *__pyx_n_s_OnlineFeatureContext;
+static PyObject *__pyx_n_s_Phrase___iter;
+static PyObject *__pyx_n_s_Phrase_iterspans;
static PyObject *__pyx_kp_s_Precomputation_done_with_max_ini;
static PyObject *__pyx_kp_s_Precomputation_done_with_max_non;
static PyObject *__pyx_kp_s_Precomputation_done_with_max_ter;
@@ -3439,6 +3404,7 @@ static PyObject *__pyx_kp_s_Refining_sort_depth_d;
static PyObject *__pyx_kp_s_Requested_index_d_d_of_d_length;
static PyObject *__pyx_kp_s_Requested_index_d_of_d_length_Fl;
static PyObject *__pyx_kp_s_Requested_index_d_of_d_length_In;
+static PyObject *__pyx_n_s_Rule_alignments;
static PyObject *__pyx_kp_s_Sampling_strategy_no_sampling;
static PyObject *__pyx_kp_s_Sampling_strategy_uniform_max_sa;
static PyObject *__pyx_kp_s_Sort_error_in_CLex;
@@ -3450,6 +3416,9 @@ static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unable_to_extract_basic_phrase;
static PyObject *__pyx_kp_s_Unaligned_chunk;
static PyObject *__pyx_kp_s_Unexpected_condition_found_in_q3;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my_2;
+static PyObject *__pyx_kp_s_Users_waziz_workspace_mtm14_my_3;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s_X;
static PyObject *__pyx_kp_s_X_0_1_2;
@@ -3493,6 +3462,7 @@ static PyObject *__pyx_n_s_col;
static PyObject *__pyx_n_s_collect;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_columns;
+static PyObject *__pyx_n_s_compute_stats;
static PyObject *__pyx_n_s_ctx_name;
static PyObject *__pyx_n_s_curr_idx;
static PyObject *__pyx_kp_s_d;
@@ -3504,8 +3474,11 @@ static PyObject *__pyx_kp_s_d_s;
static PyObject *__pyx_kp_s_d_sentences;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode_lattice;
+static PyObject *__pyx_n_s_decode_lattice_locals_genexpr;
static PyObject *__pyx_n_s_decode_sentence;
+static PyObject *__pyx_n_s_decode_sentence_locals_genexpr;
static PyObject *__pyx_n_s_decode_words;
+static PyObject *__pyx_n_s_decode_words_locals_genexpr;
static PyObject *__pyx_n_s_defaultdict;
static PyObject *__pyx_n_s_dist;
static PyObject *__pyx_n_s_doquicksort;
@@ -3519,6 +3492,7 @@ static PyObject *__pyx_n_s_e_words;
static PyObject *__pyx_n_s_earray;
static PyObject *__pyx_n_s_edarray;
static PyObject *__pyx_n_s_encode_words;
+static PyObject *__pyx_n_s_encode_words_locals_genexpr;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_enumerate;
@@ -3536,7 +3510,9 @@ static PyObject *__pyx_n_s_f_text;
static PyObject *__pyx_n_s_f_words;
static PyObject *__pyx_n_s_fcount;
static PyObject *__pyx_n_s_filename;
+static PyObject *__pyx_n_s_fmt_rule_locals_genexpr;
static PyObject *__pyx_n_s_form_rule;
+static PyObject *__pyx_n_s_form_rule_locals_genexpr;
static PyObject *__pyx_n_s_form_rule_locals_lambda;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fphrase;
@@ -3577,6 +3553,8 @@ static PyObject *__pyx_n_s_increment;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_initial_len;
+static PyObject *__pyx_n_s_input;
+static PyObject *__pyx_n_s_input_locals_genexpr;
static PyObject *__pyx_n_s_input_locals_lambda;
static PyObject *__pyx_n_s_input_locals_lambda_locals_lambd;
static PyObject *__pyx_n_s_input_match;
@@ -3584,7 +3562,11 @@ static PyObject *__pyx_n_s_input_span;
static PyObject *__pyx_n_s_insert;
static PyObject *__pyx_n_s_isa;
static PyObject *__pyx_n_s_isvar;
+static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_iteritems;
+static PyObject *__pyx_n_s_iterspans;
+static PyObject *__pyx_n_s_iterspans_locals_lambda;
+static PyObject *__pyx_n_s_iterspans_locals_lambda_locals_l;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_itervalues;
static PyObject *__pyx_n_s_ito;
@@ -3607,6 +3589,7 @@ static PyObject *__pyx_n_s_lookup;
static PyObject *__pyx_n_s_low;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_lattice;
+static PyObject *__pyx_n_s_make_lattice_locals_genexpr;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_matches;
static PyObject *__pyx_n_s_max;
@@ -3633,6 +3616,7 @@ static PyObject *__pyx_n_s_new_min_bound;
static PyObject *__pyx_n_s_next_states;
static PyObject *__pyx_n_s_nt;
static PyObject *__pyx_n_s_nt_collision;
+static PyObject *__pyx_n_s_nt_flag;
static PyObject *__pyx_n_s_nt_open;
static PyObject *__pyx_n_s_ntc;
static PyObject *__pyx_n_s_num_subpatterns;
@@ -3667,6 +3651,7 @@ static PyObject *__pyx_n_s_reachable;
static PyObject *__pyx_n_s_reachable_buffer;
static PyObject *__pyx_n_s_read_binary;
static PyObject *__pyx_n_s_read_bitext;
+static PyObject *__pyx_n_s_read_bitext_locals_genexpr;
static PyObject *__pyx_n_s_read_text;
static PyObject *__pyx_n_s_read_text_data;
static PyObject *__pyx_n_s_require_aligned_chunks;
@@ -3710,6 +3695,7 @@ static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_stats;
static PyObject *__pyx_n_s_stop;
+static PyObject *__pyx_n_s_str___locals_genexpr;
static PyObject *__pyx_n_s_suffix_link;
static PyObject *__pyx_n_s_sym;
static PyObject *__pyx_n_s_syms;
@@ -3718,6 +3704,7 @@ static PyObject *__pyx_n_s_test_sentence;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_tight_phrases;
static PyObject *__pyx_n_s_toMap;
+static PyObject *__pyx_n_s_to_str;
static PyObject *__pyx_n_s_train_max_initial_size;
static PyObject *__pyx_n_s_train_min_gap_size;
static PyObject *__pyx_n_s_unlink;
@@ -3726,9 +3713,6 @@ static PyObject *__pyx_n_s_use_baeza_yates;
static PyObject *__pyx_n_s_use_collocations;
static PyObject *__pyx_n_s_use_index;
static PyObject *__pyx_n_s_use_sent_id;
-static PyObject *__pyx_kp_s_usr0_home_mdenkows_cdec_python;
-static PyObject *__pyx_kp_s_usr0_home_mdenkows_cdec_python_2;
-static PyObject *__pyx_kp_s_usr0_home_mdenkows_cdec_python_3;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_vec;
static PyObject *__pyx_n_s_w;
@@ -3847,7 +3831,7 @@ static PyObject *__pyx_codeobj__96;
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_1monitor_cpu = {__Pyx_NAMESTR("monitor_cpu"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu, METH_NOARGS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_1monitor_cpu = {"monitor_cpu", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu, METH_NOARGS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -3866,6 +3850,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -3879,28 +3865,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getrusage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __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_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RUSAGE_SELF); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getrusage); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ru_utime); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RUSAGE_SELF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ru_utime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cdec/sa/_sa.pyx":7
* def monitor_cpu():
@@ -3909,28 +3912,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
*
* def gzip_or_text(char* filename):
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_getrusage); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_RUSAGE_SELF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_getrusage); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ru_stime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_resource); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_RUSAGE_SELF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ru_stime); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cdec/sa/_sa.pyx":6
*
@@ -3939,12 +3959,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
* resource.getrusage(resource.RUSAGE_SELF).ru_stime)
*
*/
- __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
/* "cdec/sa/_sa.pyx":5
@@ -3961,6 +3981,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec.sa._sa.monitor_cpu", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -3979,7 +4001,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__p
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_3gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_3gzip_or_text = {__Pyx_NAMESTR("gzip_or_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3gzip_or_text, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_3gzip_or_text = {"gzip_or_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3gzip_or_text, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_3gzip_or_text(PyObject *__pyx_self, PyObject *__pyx_arg_filename) {
char *__pyx_v_filename;
int __pyx_lineno = 0;
@@ -4011,6 +4033,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *_
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -4037,21 +4061,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *_
* return open(filename)
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_GzipFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -4095,6 +4136,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec.sa._sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -4103,7 +4146,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":11
+/* "cdec/sa/float_list.pxi":11
* cdef class FloatList:
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<<
@@ -4203,7 +4246,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
int __pyx_t_1;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":12
+ /* "cdec/sa/float_list.pxi":12
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0):
* if initial_len > size: # <<<<<<<<<<<<<<
@@ -4213,7 +4256,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":13
+ /* "cdec/sa/float_list.pxi":13
* def __cinit__(self, int size=0, int increment=1, int initial_len=0):
* if initial_len > size:
* size = initial_len # <<<<<<<<<<<<<<
@@ -4225,7 +4268,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":14
+ /* "cdec/sa/float_list.pxi":14
* if initial_len > size:
* size = initial_len
* self.size = size # <<<<<<<<<<<<<<
@@ -4234,7 +4277,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->size = __pyx_v_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":15
+ /* "cdec/sa/float_list.pxi":15
* size = initial_len
* self.size = size
* self.increment = increment # <<<<<<<<<<<<<<
@@ -4243,7 +4286,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->increment = __pyx_v_increment;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":16
+ /* "cdec/sa/float_list.pxi":16
* self.size = size
* self.increment = increment
* self.len = initial_len # <<<<<<<<<<<<<<
@@ -4252,7 +4295,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->len = __pyx_v_initial_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":17
+ /* "cdec/sa/float_list.pxi":17
* self.increment = increment
* self.len = initial_len
* self.arr = <float*> malloc(size*sizeof(float)) # <<<<<<<<<<<<<<
@@ -4261,7 +4304,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->arr = ((float *)malloc((__pyx_v_size * (sizeof(float)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":18
+ /* "cdec/sa/float_list.pxi":18
* self.len = initial_len
* self.arr = <float*> malloc(size*sizeof(float))
* memset(self.arr, 0, initial_len*sizeof(float)) # <<<<<<<<<<<<<<
@@ -4270,7 +4313,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
*/
memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(float))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":11
+ /* "cdec/sa/float_list.pxi":11
* cdef class FloatList:
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<<
@@ -4284,7 +4327,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":20
+/* "cdec/sa/float_list.pxi":20
* memset(self.arr, 0, initial_len*sizeof(float))
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -4307,7 +4350,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":21
+ /* "cdec/sa/float_list.pxi":21
*
* def __dealloc__(self):
* free(self.arr) # <<<<<<<<<<<<<<
@@ -4316,7 +4359,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cd
*/
free(__pyx_v_self->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":20
+ /* "cdec/sa/float_list.pxi":20
* memset(self.arr, 0, initial_len*sizeof(float))
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -4328,7 +4371,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cd
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":23
+/* "cdec/sa/float_list.pxi":23
* free(self.arr)
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -4357,14 +4400,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
- int __pyx_t_5;
- Py_ssize_t __pyx_t_6;
+ Py_ssize_t __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":24
+ /* "cdec/sa/float_list.pxi":24
*
* def __getitem__(self, i):
* j = i # <<<<<<<<<<<<<<
@@ -4374,7 +4416,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
__Pyx_INCREF(__pyx_v_i);
__pyx_v_j = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":25
+ /* "cdec/sa/float_list.pxi":25
* def __getitem__(self, i):
* j = i
* if i<0: # <<<<<<<<<<<<<<
@@ -4386,7 +4428,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":26
+ /* "cdec/sa/float_list.pxi":26
* j = i
* if i<0:
* j = self.len + i # <<<<<<<<<<<<<<
@@ -4404,7 +4446,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":27
+ /* "cdec/sa/float_list.pxi":27
* if i<0:
* j = self.len + i
* if j<0 or j>=self.len: # <<<<<<<<<<<<<<
@@ -4412,22 +4454,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
* return self.arr[j]
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_j, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (!__pyx_t_2) {
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_j, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __pyx_t_4;
+ if (!__pyx_t_4) {
+ goto __pyx_L6_next_or;
} else {
- __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_4;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L6_next_or:;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_j, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":28
+ /* "cdec/sa/float_list.pxi":28
* j = self.len + i
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) # <<<<<<<<<<<<<<
@@ -4460,7 +4506,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":29
+ /* "cdec/sa/float_list.pxi":29
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len))
* return self.arr[j] # <<<<<<<<<<<<<<
@@ -4468,14 +4514,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
* cdef void set(self, int i, float v):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->arr[__pyx_t_6])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_j); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->arr[__pyx_t_5])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":23
+ /* "cdec/sa/float_list.pxi":23
* free(self.arr)
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -4496,7 +4542,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":31
+/* "cdec/sa/float_list.pxi":31
* return self.arr[j]
*
* cdef void set(self, int i, float v): # <<<<<<<<<<<<<<
@@ -4509,16 +4555,15 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
+ PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":32
+ /* "cdec/sa/float_list.pxi":32
*
* cdef void set(self, int i, float v):
* j = i # <<<<<<<<<<<<<<
@@ -4527,7 +4572,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
*/
__pyx_v_j = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":33
+ /* "cdec/sa/float_list.pxi":33
* cdef void set(self, int i, float v):
* j = i
* if i<0: # <<<<<<<<<<<<<<
@@ -4537,7 +4582,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
__pyx_t_1 = ((__pyx_v_i < 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":34
+ /* "cdec/sa/float_list.pxi":34
* j = i
* if i<0:
* j = self.len + i # <<<<<<<<<<<<<<
@@ -4549,58 +4594,62 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":35
+ /* "cdec/sa/float_list.pxi":35
* if i<0:
* j = self.len + i
* if j<0 or j>=self.len: # <<<<<<<<<<<<<<
* raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len))
* self.arr[j] = v
*/
- __pyx_t_1 = ((__pyx_v_j < 0) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_j < 0) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L6_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L6_next_or:;
+ __pyx_t_2 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":36
+ /* "cdec/sa/float_list.pxi":36
* j = self.len + i
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len)) # <<<<<<<<<<<<<<
* self.arr[j] = v
*
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_Fl, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_Fl, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":37
+ /* "cdec/sa/float_list.pxi":37
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length FloatList" % (i, self.len))
* self.arr[j] = v # <<<<<<<<<<<<<<
@@ -4609,7 +4658,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
*/
(__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_v;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":31
+ /* "cdec/sa/float_list.pxi":31
* return self.arr[j]
*
* cdef void set(self, int i, float v): # <<<<<<<<<<<<<<
@@ -4620,15 +4669,15 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_set(struct __pyx_obj_4cdec_2sa_3_s
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
__Pyx_WriteUnraisable("cdec.sa._sa.FloatList.set", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":39
+/* "cdec/sa/float_list.pxi":39
* self.arr[j] = v
*
* def __setitem__(self, i, val): # <<<<<<<<<<<<<<
@@ -4659,7 +4708,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":40
+ /* "cdec/sa/float_list.pxi":40
*
* def __setitem__(self, i, val):
* self.set(i, val) # <<<<<<<<<<<<<<
@@ -4670,7 +4719,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cde
__pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_v_val); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":39
+ /* "cdec/sa/float_list.pxi":39
* self.arr[j] = v
*
* def __setitem__(self, i, val): # <<<<<<<<<<<<<<
@@ -4689,7 +4738,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":42
+/* "cdec/sa/float_list.pxi":42
* self.set(i, val)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -4715,7 +4764,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":43
+ /* "cdec/sa/float_list.pxi":43
*
* def __len__(self):
* return self.len # <<<<<<<<<<<<<<
@@ -4725,7 +4774,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4
__pyx_r = __pyx_v_self->len;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":42
+ /* "cdec/sa/float_list.pxi":42
* self.set(i, val)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -4739,7 +4788,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":45
+/* "cdec/sa/float_list.pxi":45
* return self.len
*
* def append(self, float val): # <<<<<<<<<<<<<<
@@ -4779,7 +4828,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
int __pyx_t_1;
__Pyx_RefNannySetupContext("append", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":46
+ /* "cdec/sa/float_list.pxi":46
*
* def append(self, float val):
* if self.len == self.size: # <<<<<<<<<<<<<<
@@ -4789,7 +4838,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
__pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":47
+ /* "cdec/sa/float_list.pxi":47
* def append(self, float val):
* if self.len == self.size:
* self.size = self.size + self.increment # <<<<<<<<<<<<<<
@@ -4798,7 +4847,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
*/
__pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":48
+ /* "cdec/sa/float_list.pxi":48
* if self.len == self.size:
* self.size = self.size + self.increment
* self.arr = <float*> realloc(self.arr, self.size*sizeof(float)) # <<<<<<<<<<<<<<
@@ -4810,7 +4859,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":49
+ /* "cdec/sa/float_list.pxi":49
* self.size = self.size + self.increment
* self.arr = <float*> realloc(self.arr, self.size*sizeof(float))
* self.arr[self.len] = val # <<<<<<<<<<<<<<
@@ -4819,7 +4868,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
*/
(__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":50
+ /* "cdec/sa/float_list.pxi":50
* self.arr = <float*> realloc(self.arr, self.size*sizeof(float))
* self.arr[self.len] = val
* self.len = self.len + 1 # <<<<<<<<<<<<<<
@@ -4828,7 +4877,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
*/
__pyx_v_self->len = (__pyx_v_self->len + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":45
+ /* "cdec/sa/float_list.pxi":45
* return self.len
*
* def append(self, float val): # <<<<<<<<<<<<<<
@@ -4843,7 +4892,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":52
+/* "cdec/sa/float_list.pxi":52
* self.len = self.len + 1
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -4855,7 +4904,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle(struct __pyx_obj_4cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":53
+ /* "cdec/sa/float_list.pxi":53
*
* cdef void write_handle(self, FILE* f):
* fwrite(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<<
@@ -4864,7 +4913,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle(struct __pyx_obj_4cde
*/
fwrite((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":54
+ /* "cdec/sa/float_list.pxi":54
* cdef void write_handle(self, FILE* f):
* fwrite(&(self.len), sizeof(float), 1, f)
* fwrite(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<<
@@ -4873,7 +4922,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle(struct __pyx_obj_4cde
*/
fwrite(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":52
+ /* "cdec/sa/float_list.pxi":52
* self.len = self.len + 1
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -4885,7 +4934,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle(struct __pyx_obj_4cde
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":56
+/* "cdec/sa/float_list.pxi":56
* fwrite(self.arr, sizeof(float), self.len, f)
*
* def write(self, char* filename): # <<<<<<<<<<<<<<
@@ -4925,7 +4974,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":58
+ /* "cdec/sa/float_list.pxi":58
* def write(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -4934,7 +4983,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cd
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":59
+ /* "cdec/sa/float_list.pxi":59
* cdef FILE* f
* f = fopen(filename, "w")
* self.write_handle(f) # <<<<<<<<<<<<<<
@@ -4943,7 +4992,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cd
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":60
+ /* "cdec/sa/float_list.pxi":60
* f = fopen(filename, "w")
* self.write_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -4952,7 +5001,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cd
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":56
+ /* "cdec/sa/float_list.pxi":56
* fwrite(self.arr, sizeof(float), self.len, f)
*
* def write(self, char* filename): # <<<<<<<<<<<<<<
@@ -4967,7 +5016,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":62
+/* "cdec/sa/float_list.pxi":62
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -4980,7 +5029,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
int __pyx_t_1;
__Pyx_RefNannySetupContext("read_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":63
+ /* "cdec/sa/float_list.pxi":63
*
* cdef void read_handle(self, FILE* f):
* free(self.arr) # <<<<<<<<<<<<<<
@@ -4989,7 +5038,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
*/
free(__pyx_v_self->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":64
+ /* "cdec/sa/float_list.pxi":64
* cdef void read_handle(self, FILE* f):
* free(self.arr)
* fread(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<<
@@ -4998,7 +5047,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
*/
fread((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":65
+ /* "cdec/sa/float_list.pxi":65
* free(self.arr)
* fread(&(self.len), sizeof(float), 1, f)
* self.arr = <float*> malloc(self.len * sizeof(float)) # <<<<<<<<<<<<<<
@@ -5007,7 +5056,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
*/
__pyx_v_self->arr = ((float *)malloc((__pyx_v_self->len * (sizeof(float)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":66
+ /* "cdec/sa/float_list.pxi":66
* fread(&(self.len), sizeof(float), 1, f)
* self.arr = <float*> malloc(self.len * sizeof(float))
* self.size = self.len # <<<<<<<<<<<<<<
@@ -5017,7 +5066,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
__pyx_t_1 = __pyx_v_self->len;
__pyx_v_self->size = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":67
+ /* "cdec/sa/float_list.pxi":67
* self.arr = <float*> malloc(self.len * sizeof(float))
* self.size = self.len
* fread(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<<
@@ -5026,7 +5075,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
*/
fread(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":62
+ /* "cdec/sa/float_list.pxi":62
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -5038,7 +5087,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle(struct __pyx_obj_4cdec
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":69
+/* "cdec/sa/float_list.pxi":69
* fread(self.arr, sizeof(float), self.len, f)
*
* def read(self, char* filename): # <<<<<<<<<<<<<<
@@ -5078,7 +5127,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":71
+ /* "cdec/sa/float_list.pxi":71
* def read(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -5087,7 +5136,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cde
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":72
+ /* "cdec/sa/float_list.pxi":72
* cdef FILE* f
* f = fopen(filename, "r")
* self.read_handle(f) # <<<<<<<<<<<<<<
@@ -5095,14 +5144,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cde
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":73
+ /* "cdec/sa/float_list.pxi":73
* f = fopen(filename, "r")
* self.read_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":69
+ /* "cdec/sa/float_list.pxi":69
* fread(self.arr, sizeof(float), self.len, f)
*
* def read(self, char* filename): # <<<<<<<<<<<<<<
@@ -5117,7 +5166,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":11
+/* "cdec/sa/int_list.pxi":11
* cdef class IntList:
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<<
@@ -5217,7 +5266,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
int __pyx_t_1;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":12
+ /* "cdec/sa/int_list.pxi":12
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0):
* if initial_len > size: # <<<<<<<<<<<<<<
@@ -5227,7 +5276,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
__pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":13
+ /* "cdec/sa/int_list.pxi":13
* def __cinit__(self, int size=0, int increment=1, int initial_len=0):
* if initial_len > size:
* size = initial_len # <<<<<<<<<<<<<<
@@ -5239,7 +5288,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":14
+ /* "cdec/sa/int_list.pxi":14
* if initial_len > size:
* size = initial_len
* self.size = size # <<<<<<<<<<<<<<
@@ -5248,7 +5297,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->size = __pyx_v_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":15
+ /* "cdec/sa/int_list.pxi":15
* size = initial_len
* self.size = size
* self.increment = increment # <<<<<<<<<<<<<<
@@ -5257,7 +5306,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->increment = __pyx_v_increment;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":16
+ /* "cdec/sa/int_list.pxi":16
* self.size = size
* self.increment = increment
* self.len = initial_len # <<<<<<<<<<<<<<
@@ -5266,7 +5315,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->len = __pyx_v_initial_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":17
+ /* "cdec/sa/int_list.pxi":17
* self.increment = increment
* self.len = initial_len
* self.arr = <int*> malloc(size*sizeof(int)) # <<<<<<<<<<<<<<
@@ -5275,7 +5324,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->arr = ((int *)malloc((__pyx_v_size * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":18
+ /* "cdec/sa/int_list.pxi":18
* self.len = initial_len
* self.arr = <int*> malloc(size*sizeof(int))
* memset(self.arr, 0, initial_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -5284,7 +5333,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
*/
memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":11
+ /* "cdec/sa/int_list.pxi":11
* cdef class IntList:
*
* def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<<
@@ -5298,7 +5347,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":20
+/* "cdec/sa/int_list.pxi":20
* memset(self.arr, 0, initial_len*sizeof(int))
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5334,7 +5383,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":22
+ /* "cdec/sa/int_list.pxi":22
* def __str__(self):
* cdef unsigned i
* ret = "IntList[" # <<<<<<<<<<<<<<
@@ -5344,7 +5393,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__Pyx_INCREF(__pyx_kp_s_IntList);
__pyx_v_ret = __pyx_kp_s_IntList;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":23
+ /* "cdec/sa/int_list.pxi":23
* cdef unsigned i
* ret = "IntList["
* for idx in range(self.size): # <<<<<<<<<<<<<<
@@ -5355,7 +5404,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_idx = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":24
+ /* "cdec/sa/int_list.pxi":24
* ret = "IntList["
* for idx in range(self.size):
* if idx>0: # <<<<<<<<<<<<<<
@@ -5365,7 +5414,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__pyx_t_3 = ((__pyx_v_idx > 0) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":25
+ /* "cdec/sa/int_list.pxi":25
* for idx in range(self.size):
* if idx>0:
* ret += "," # <<<<<<<<<<<<<<
@@ -5380,7 +5429,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":26
+ /* "cdec/sa/int_list.pxi":26
* if idx>0:
* ret += ","
* ret += str(self.arr[idx]) # <<<<<<<<<<<<<<
@@ -5404,7 +5453,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__pyx_t_5 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":27
+ /* "cdec/sa/int_list.pxi":27
* ret += ","
* ret += str(self.arr[idx])
* ret += "]" # <<<<<<<<<<<<<<
@@ -5416,7 +5465,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":28
+ /* "cdec/sa/int_list.pxi":28
* ret += str(self.arr[idx])
* ret += "]"
* ret += "len=" # <<<<<<<<<<<<<<
@@ -5428,7 +5477,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":29
+ /* "cdec/sa/int_list.pxi":29
* ret += "]"
* ret += "len="
* ret += str(self.len) # <<<<<<<<<<<<<<
@@ -5451,7 +5500,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__Pyx_DECREF_SET(__pyx_v_ret, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":30
+ /* "cdec/sa/int_list.pxi":30
* ret += "len="
* ret += str(self.len)
* return ret # <<<<<<<<<<<<<<
@@ -5463,7 +5512,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
__pyx_r = __pyx_v_ret;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":20
+ /* "cdec/sa/int_list.pxi":20
* memset(self.arr, 0, initial_len*sizeof(int))
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -5484,7 +5533,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":32
+/* "cdec/sa/int_list.pxi":32
* return ret
*
* def index(self, int val): # <<<<<<<<<<<<<<
@@ -5532,7 +5581,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("index", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":34
+ /* "cdec/sa/int_list.pxi":34
* def index(self, int val):
* cdef unsigned i
* for i in range(self.len): # <<<<<<<<<<<<<<
@@ -5543,7 +5592,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":35
+ /* "cdec/sa/int_list.pxi":35
* cdef unsigned i
* for i in range(self.len):
* if self.arr[i] == val: # <<<<<<<<<<<<<<
@@ -5553,7 +5602,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
__pyx_t_3 = (((__pyx_v_self->arr[__pyx_v_i]) == __pyx_v_val) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":36
+ /* "cdec/sa/int_list.pxi":36
* for i in range(self.len):
* if self.arr[i] == val:
* return i # <<<<<<<<<<<<<<
@@ -5569,7 +5618,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":37
+ /* "cdec/sa/int_list.pxi":37
* if self.arr[i] == val:
* return i
* raise ValueError('%s not in IntList' % val) # <<<<<<<<<<<<<<
@@ -5593,7 +5642,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":32
+ /* "cdec/sa/int_list.pxi":32
* return ret
*
* def index(self, int val): # <<<<<<<<<<<<<<
@@ -5613,7 +5662,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":39
+/* "cdec/sa/int_list.pxi":39
* raise ValueError('%s not in IntList' % val)
*
* def partition(self,start,end): # <<<<<<<<<<<<<<
@@ -5700,7 +5749,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("partition", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":40
+ /* "cdec/sa/int_list.pxi":40
*
* def partition(self,start,end):
* pivot = self.arr[end] # <<<<<<<<<<<<<<
@@ -5713,7 +5762,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_v_pivot = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":41
+ /* "cdec/sa/int_list.pxi":41
* def partition(self,start,end):
* pivot = self.arr[end]
* bottom = start-1 # <<<<<<<<<<<<<<
@@ -5725,7 +5774,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_v_bottom = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":42
+ /* "cdec/sa/int_list.pxi":42
* pivot = self.arr[end]
* bottom = start-1
* top = end # <<<<<<<<<<<<<<
@@ -5735,7 +5784,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_INCREF(__pyx_v_end);
__pyx_v_top = __pyx_v_end;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":43
+ /* "cdec/sa/int_list.pxi":43
* bottom = start-1
* top = end
* done = 0 # <<<<<<<<<<<<<<
@@ -5744,7 +5793,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
*/
__pyx_v_done = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":44
+ /* "cdec/sa/int_list.pxi":44
* top = end
* done = 0
* while not done: # <<<<<<<<<<<<<<
@@ -5755,7 +5804,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_3 = ((!(__pyx_v_done != 0)) != 0);
if (!__pyx_t_3) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":45
+ /* "cdec/sa/int_list.pxi":45
* done = 0
* while not done:
* while not done: # <<<<<<<<<<<<<<
@@ -5766,7 +5815,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_3 = ((!(__pyx_v_done != 0)) != 0);
if (!__pyx_t_3) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":46
+ /* "cdec/sa/int_list.pxi":46
* while not done:
* while not done:
* bottom += 1 # <<<<<<<<<<<<<<
@@ -5778,7 +5827,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF_SET(__pyx_v_bottom, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":47
+ /* "cdec/sa/int_list.pxi":47
* while not done:
* bottom += 1
* if bottom == top: # <<<<<<<<<<<<<<
@@ -5790,7 +5839,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":48
+ /* "cdec/sa/int_list.pxi":48
* bottom += 1
* if bottom == top:
* done = 1 # <<<<<<<<<<<<<<
@@ -5799,7 +5848,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
*/
__pyx_v_done = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":49
+ /* "cdec/sa/int_list.pxi":49
* if bottom == top:
* done = 1
* break # <<<<<<<<<<<<<<
@@ -5809,7 +5858,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
goto __pyx_L6_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":50
+ /* "cdec/sa/int_list.pxi":50
* done = 1
* break
* if self.arr[bottom] > pivot: # <<<<<<<<<<<<<<
@@ -5825,7 +5874,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":51
+ /* "cdec/sa/int_list.pxi":51
* break
* if self.arr[bottom] > pivot:
* self.arr[top] = self.arr[bottom] # <<<<<<<<<<<<<<
@@ -5836,7 +5885,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->arr[__pyx_t_5]) = (__pyx_v_self->arr[__pyx_t_1]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":52
+ /* "cdec/sa/int_list.pxi":52
* if self.arr[bottom] > pivot:
* self.arr[top] = self.arr[bottom]
* break # <<<<<<<<<<<<<<
@@ -5848,7 +5897,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
}
__pyx_L6_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":53
+ /* "cdec/sa/int_list.pxi":53
* self.arr[top] = self.arr[bottom]
* break
* while not done: # <<<<<<<<<<<<<<
@@ -5859,7 +5908,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_3 = ((!(__pyx_v_done != 0)) != 0);
if (!__pyx_t_3) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":54
+ /* "cdec/sa/int_list.pxi":54
* break
* while not done:
* top -= 1 # <<<<<<<<<<<<<<
@@ -5871,7 +5920,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF_SET(__pyx_v_top, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":55
+ /* "cdec/sa/int_list.pxi":55
* while not done:
* top -= 1
* if top == bottom: # <<<<<<<<<<<<<<
@@ -5883,7 +5932,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":56
+ /* "cdec/sa/int_list.pxi":56
* top -= 1
* if top == bottom:
* done = 1 # <<<<<<<<<<<<<<
@@ -5892,7 +5941,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
*/
__pyx_v_done = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":57
+ /* "cdec/sa/int_list.pxi":57
* if top == bottom:
* done = 1
* break # <<<<<<<<<<<<<<
@@ -5902,7 +5951,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
goto __pyx_L10_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":58
+ /* "cdec/sa/int_list.pxi":58
* done = 1
* break
* if self.arr[top] < pivot: # <<<<<<<<<<<<<<
@@ -5918,7 +5967,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":59
+ /* "cdec/sa/int_list.pxi":59
* break
* if self.arr[top] < pivot:
* self.arr[bottom] = self.arr[top] # <<<<<<<<<<<<<<
@@ -5929,7 +5978,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->arr[__pyx_t_5]) = (__pyx_v_self->arr[__pyx_t_1]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":60
+ /* "cdec/sa/int_list.pxi":60
* if self.arr[top] < pivot:
* self.arr[bottom] = self.arr[top]
* break # <<<<<<<<<<<<<<
@@ -5942,7 +5991,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_L10_break:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":61
+ /* "cdec/sa/int_list.pxi":61
* self.arr[bottom] = self.arr[top]
* break
* self.arr[top] = pivot # <<<<<<<<<<<<<<
@@ -5953,7 +6002,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_top); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->arr[__pyx_t_1]) = __pyx_t_6;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":62
+ /* "cdec/sa/int_list.pxi":62
* break
* self.arr[top] = pivot
* return top # <<<<<<<<<<<<<<
@@ -5965,7 +6014,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
__pyx_r = __pyx_v_top;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":39
+ /* "cdec/sa/int_list.pxi":39
* raise ValueError('%s not in IntList' % val)
*
* def partition(self,start,end): # <<<<<<<<<<<<<<
@@ -5988,7 +6037,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":64
+/* "cdec/sa/int_list.pxi":64
* return top
*
* def _doquicksort(self,start,end): # <<<<<<<<<<<<<<
@@ -6065,12 +6114,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_doquicksort", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":65
+ /* "cdec/sa/int_list.pxi":65
*
* def _doquicksort(self,start,end):
* if start < end: # <<<<<<<<<<<<<<
@@ -6082,56 +6134,86 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":66
+ /* "cdec/sa/int_list.pxi":66
* def _doquicksort(self,start,end):
* if start < end:
* split = self.partition(start,end) # <<<<<<<<<<<<<<
* self._doquicksort(start,split-1)
* self._doquicksort(split+1,end)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_partition); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_partition); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_v_start);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_start);
__Pyx_GIVEREF(__pyx_v_start);
__Pyx_INCREF(__pyx_v_end);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_end);
__Pyx_GIVEREF(__pyx_v_end);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_split = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_v_split = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":67
+ /* "cdec/sa/int_list.pxi":67
* if start < end:
* split = self.partition(start,end)
* self._doquicksort(start,split-1) # <<<<<<<<<<<<<<
* self._doquicksort(split+1,end)
* else:
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doquicksort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Subtract(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doquicksort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_6 = PyNumber_Subtract(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_v_start);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_start);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_start);
__Pyx_GIVEREF(__pyx_v_start);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":68
+ /* "cdec/sa/int_list.pxi":68
* split = self.partition(start,end)
* self._doquicksort(start,split-1)
* self._doquicksort(split+1,end) # <<<<<<<<<<<<<<
@@ -6140,26 +6222,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doquicksort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyNumber_Add(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Add(__pyx_v_split, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ if (__pyx_t_6) {
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_end);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_end);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_end);
__Pyx_GIVEREF(__pyx_v_end);
- __pyx_t_1 = 0;
+ __pyx_t_7 = 0;
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":70
+ /* "cdec/sa/int_list.pxi":70
* self._doquicksort(split+1,end)
* else:
* return # <<<<<<<<<<<<<<
@@ -6172,7 +6269,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":64
+ /* "cdec/sa/int_list.pxi":64
* return top
*
* def _doquicksort(self,start,end): # <<<<<<<<<<<<<<
@@ -6187,6 +6284,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -6196,7 +6295,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":72
+/* "cdec/sa/int_list.pxi":72
* return
*
* def sort(self): # <<<<<<<<<<<<<<
@@ -6223,37 +6322,55 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sort", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":73
+ /* "cdec/sa/int_list.pxi":73
*
* def sort(self):
* self._doquicksort(0,self.len-1) # <<<<<<<<<<<<<<
*
* def reset(self):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doquicksort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_self->len - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_doquicksort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_self->len - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":72
+ /* "cdec/sa/int_list.pxi":72
* return
*
* def sort(self): # <<<<<<<<<<<<<<
@@ -6268,6 +6385,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec.sa._sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -6276,7 +6395,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":75
+/* "cdec/sa/int_list.pxi":75
* self._doquicksort(0,self.len-1)
*
* def reset(self): # <<<<<<<<<<<<<<
@@ -6302,7 +6421,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reset", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":76
+ /* "cdec/sa/int_list.pxi":76
*
* def reset(self):
* self.len = 0 # <<<<<<<<<<<<<<
@@ -6311,7 +6430,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec
*/
__pyx_v_self->len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":75
+ /* "cdec/sa/int_list.pxi":75
* self._doquicksort(0,self.len-1)
*
* def reset(self): # <<<<<<<<<<<<<<
@@ -6326,7 +6445,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":78
+/* "cdec/sa/int_list.pxi":78
* self.len = 0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -6349,7 +6468,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":79
+ /* "cdec/sa/int_list.pxi":79
*
* def __dealloc__(self):
* free(self.arr) # <<<<<<<<<<<<<<
@@ -6358,7 +6477,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cde
*/
free(__pyx_v_self->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":78
+ /* "cdec/sa/int_list.pxi":78
* self.len = 0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -6371,7 +6490,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cde
}
static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81
+/* "cdec/sa/int_list.pxi":81
* free(self.arr)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -6410,19 +6529,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4c
__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_2sa_3_sa_7IntList_18generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_7IntList_18generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_IntList___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.IntList.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -6451,7 +6567,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":83
+ /* "cdec/sa/int_list.pxi":83
* def __iter__(self):
* cdef int i
* for i in range(self.len): # <<<<<<<<<<<<<<
@@ -6462,7 +6578,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__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;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":84
+ /* "cdec/sa/int_list.pxi":84
* cdef int i
* for i in range(self.len):
* yield self.arr[i] # <<<<<<<<<<<<<<
@@ -6486,7 +6602,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObj
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81
+ /* "cdec/sa/int_list.pxi":81
* free(self.arr)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -6508,7 +6624,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObj
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":86
+/* "cdec/sa/int_list.pxi":86
* yield self.arr[i]
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
@@ -6539,19 +6655,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- int __pyx_t_7;
- int __pyx_t_8;
- PyObject *__pyx_t_9 = NULL;
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":88
+ /* "cdec/sa/int_list.pxi":88
* def __getitem__(self, index):
* cdef int i, j, k
* if isinstance(index, int): # <<<<<<<<<<<<<<
@@ -6562,7 +6675,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":89
+ /* "cdec/sa/int_list.pxi":89
* cdef int i, j, k
* if isinstance(index, int):
* j = index # <<<<<<<<<<<<<<
@@ -6572,7 +6685,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_index); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_j = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":90
+ /* "cdec/sa/int_list.pxi":90
* if isinstance(index, int):
* j = index
* if j < 0: # <<<<<<<<<<<<<<
@@ -6582,7 +6695,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
__pyx_t_2 = ((__pyx_v_j < 0) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":91
+ /* "cdec/sa/int_list.pxi":91
* j = index
* if j < 0:
* j = self.len + j # <<<<<<<<<<<<<<
@@ -6594,56 +6707,60 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":92
+ /* "cdec/sa/int_list.pxi":92
* if j < 0:
* j = self.len + j
* if j<0 or j>=self.len: # <<<<<<<<<<<<<<
* raise IndexError("Requested index %d of %d-length IntList" % (index, self.len))
* return self.arr[j]
*/
- __pyx_t_2 = ((__pyx_v_j < 0) != 0);
- if (!__pyx_t_2) {
- __pyx_t_1 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
- __pyx_t_4 = __pyx_t_1;
+ __pyx_t_1 = ((__pyx_v_j < 0) != 0);
+ if (!__pyx_t_1) {
+ goto __pyx_L7_next_or;
} else {
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_1;
+ goto __pyx_L6_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L7_next_or:;
+ __pyx_t_1 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
+ __pyx_t_2 = __pyx_t_1;
+ __pyx_L6_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":93
+ /* "cdec/sa/int_list.pxi":93
* j = self.len + j
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length IntList" % (index, self.len)) # <<<<<<<<<<<<<<
* return self.arr[j]
* elif isinstance(index, slice):
*/
- __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_index);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_index);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_index);
__Pyx_GIVEREF(__pyx_v_index);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_In, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_In, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":94
+ /* "cdec/sa/int_list.pxi":94
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length IntList" % (index, self.len))
* return self.arr[j] # <<<<<<<<<<<<<<
@@ -6651,61 +6768,61 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
* i = index.start
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_self->arr[__pyx_v_j])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->arr[__pyx_v_j])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":95
+ /* "cdec/sa/int_list.pxi":95
* raise IndexError("Requested index %d of %d-length IntList" % (index, self.len))
* return self.arr[j]
* elif isinstance(index, slice): # <<<<<<<<<<<<<<
* i = index.start
* j = index.stop
*/
- __pyx_t_4 = PySlice_Check(__pyx_v_index);
- __pyx_t_2 = (__pyx_t_4 != 0);
- if (__pyx_t_2) {
+ __pyx_t_2 = PySlice_Check(__pyx_v_index);
+ __pyx_t_1 = (__pyx_t_2 != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":96
+ /* "cdec/sa/int_list.pxi":96
* return self.arr[j]
* elif isinstance(index, slice):
* i = index.start # <<<<<<<<<<<<<<
* j = index.stop
* if i < 0:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":97
+ /* "cdec/sa/int_list.pxi":97
* elif isinstance(index, slice):
* i = index.start
* j = index.stop # <<<<<<<<<<<<<<
* if i < 0:
* i = self.len + i
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_j = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":98
+ /* "cdec/sa/int_list.pxi":98
* i = index.start
* j = index.stop
* if i < 0: # <<<<<<<<<<<<<<
* i = self.len + i
* if j < 0:
*/
- __pyx_t_2 = ((__pyx_v_i < 0) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_i < 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":99
+ /* "cdec/sa/int_list.pxi":99
* j = index.stop
* if i < 0:
* i = self.len + i # <<<<<<<<<<<<<<
@@ -6713,21 +6830,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
* j = self.len + j
*/
__pyx_v_i = (__pyx_v_self->len + __pyx_v_i);
- goto __pyx_L6;
+ goto __pyx_L8;
}
- __pyx_L6:;
+ __pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":100
+ /* "cdec/sa/int_list.pxi":100
* if i < 0:
* i = self.len + i
* if j < 0: # <<<<<<<<<<<<<<
* j = self.len + j
* if i < 0 or i >= self.len or j < 0 or j > self.len:
*/
- __pyx_t_2 = ((__pyx_v_j < 0) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_j < 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":101
+ /* "cdec/sa/int_list.pxi":101
* i = self.len + i
* if j < 0:
* j = self.len + j # <<<<<<<<<<<<<<
@@ -6735,11 +6852,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
* raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len))
*/
__pyx_v_j = (__pyx_v_self->len + __pyx_v_j);
- goto __pyx_L7;
+ goto __pyx_L9;
}
- __pyx_L7:;
+ __pyx_L9:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":102
+ /* "cdec/sa/int_list.pxi":102
* if j < 0:
* j = self.len + j
* if i < 0 or i >= self.len or j < 0 or j > self.len: # <<<<<<<<<<<<<<
@@ -6748,66 +6865,74 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
*/
__pyx_t_2 = ((__pyx_v_i < 0) != 0);
if (!__pyx_t_2) {
- __pyx_t_4 = ((__pyx_v_i >= __pyx_v_self->len) != 0);
- if (!__pyx_t_4) {
- __pyx_t_1 = ((__pyx_v_j < 0) != 0);
- if (!__pyx_t_1) {
- __pyx_t_7 = ((__pyx_v_j > __pyx_v_self->len) != 0);
- __pyx_t_8 = __pyx_t_7;
- } else {
- __pyx_t_8 = __pyx_t_1;
- }
- __pyx_t_1 = __pyx_t_8;
- } else {
- __pyx_t_1 = __pyx_t_4;
- }
- __pyx_t_4 = __pyx_t_1;
+ goto __pyx_L12_next_or;
} else {
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L11_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L12_next_or:;
+ __pyx_t_2 = ((__pyx_v_i >= __pyx_v_self->len) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L13_next_or;
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L11_bool_binop_done;
+ }
+ __pyx_L13_next_or:;
+ __pyx_t_2 = ((__pyx_v_j < 0) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L14_next_or;
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L11_bool_binop_done;
+ }
+ __pyx_L14_next_or:;
+ __pyx_t_2 = ((__pyx_v_j > __pyx_v_self->len) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L11_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":103
+ /* "cdec/sa/int_list.pxi":103
* j = self.len + j
* if i < 0 or i >= self.len or j < 0 or j > self.len:
* raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) # <<<<<<<<<<<<<<
* result = ()
* for k from i <= k < j:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
+ __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_4 = 0;
__pyx_t_5 = 0;
__pyx_t_6 = 0;
- __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_d_of_d_length, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_Raise(__pyx_t_9, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_d_of_d_length, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":104
+ /* "cdec/sa/int_list.pxi":104
* if i < 0 or i >= self.len or j < 0 or j > self.len:
* raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len))
* result = () # <<<<<<<<<<<<<<
@@ -6817,7 +6942,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
__Pyx_INCREF(__pyx_empty_tuple);
__pyx_v_result = __pyx_empty_tuple;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":105
+ /* "cdec/sa/int_list.pxi":105
* raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len))
* result = ()
* for k from i <= k < j: # <<<<<<<<<<<<<<
@@ -6827,28 +6952,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
__pyx_t_3 = __pyx_v_j;
for (__pyx_v_k = __pyx_v_i; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":106
+ /* "cdec/sa/int_list.pxi":106
* result = ()
* for k from i <= k < j:
* result = result + (self.arr[k],) # <<<<<<<<<<<<<<
* return result
* else:
*/
- __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_self->arr[__pyx_v_k])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Add(__pyx_v_result, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_9));
- __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->arr[__pyx_v_k])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = PyNumber_Add(__pyx_v_result, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_6));
+ __pyx_t_6 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":107
+ /* "cdec/sa/int_list.pxi":107
* for k from i <= k < j:
* result = result + (self.arr[k],)
* return result # <<<<<<<<<<<<<<
@@ -6862,29 +6987,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":109
+ /* "cdec/sa/int_list.pxi":109
* return result
* else:
* raise TypeError("Illegal key type %s for IntList" % type(index)) # <<<<<<<<<<<<<<
*
* cdef void set(self, int i, int val):
*/
- __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Illegal_key_type_s_for_IntList, ((PyObject *)Py_TYPE(__pyx_v_index))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_Raise(__pyx_t_9, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Illegal_key_type_s_for_IntList, ((PyObject *)Py_TYPE(__pyx_v_index))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_Raise(__pyx_t_6, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":86
+ /* "cdec/sa/int_list.pxi":86
* yield self.arr[i]
*
* def __getitem__(self, index): # <<<<<<<<<<<<<<
@@ -6894,10 +7019,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
/* function exit code */
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_9);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -6907,7 +7032,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":111
+/* "cdec/sa/int_list.pxi":111
* raise TypeError("Illegal key type %s for IntList" % type(index))
*
* cdef void set(self, int i, int val): # <<<<<<<<<<<<<<
@@ -6920,16 +7045,15 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
+ PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":112
+ /* "cdec/sa/int_list.pxi":112
*
* cdef void set(self, int i, int val):
* j = i # <<<<<<<<<<<<<<
@@ -6938,7 +7062,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
*/
__pyx_v_j = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":113
+ /* "cdec/sa/int_list.pxi":113
* cdef void set(self, int i, int val):
* j = i
* if i<0: # <<<<<<<<<<<<<<
@@ -6948,7 +7072,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
__pyx_t_1 = ((__pyx_v_i < 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":114
+ /* "cdec/sa/int_list.pxi":114
* j = i
* if i<0:
* j = self.len + i # <<<<<<<<<<<<<<
@@ -6960,58 +7084,62 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":115
+ /* "cdec/sa/int_list.pxi":115
* if i<0:
* j = self.len + i
* if j<0 or j>=self.len: # <<<<<<<<<<<<<<
* raise IndexError("Requested index %d of %d-length IntList" % (i, self.len))
* self.arr[j] = val
*/
- __pyx_t_1 = ((__pyx_v_j < 0) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_j < 0) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L6_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L6_next_or:;
+ __pyx_t_2 = ((__pyx_v_j >= __pyx_v_self->len) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":116
+ /* "cdec/sa/int_list.pxi":116
* j = self.len + i
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length IntList" % (i, self.len)) # <<<<<<<<<<<<<<
* self.arr[j] = val
*
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_3 = 0;
__pyx_t_4 = 0;
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_In, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Requested_index_d_of_d_length_In, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":117
+ /* "cdec/sa/int_list.pxi":117
* if j<0 or j>=self.len:
* raise IndexError("Requested index %d of %d-length IntList" % (i, self.len))
* self.arr[j] = val # <<<<<<<<<<<<<<
@@ -7020,7 +7148,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
*/
(__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_val;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":111
+ /* "cdec/sa/int_list.pxi":111
* raise TypeError("Illegal key type %s for IntList" % type(index))
*
* cdef void set(self, int i, int val): # <<<<<<<<<<<<<<
@@ -7031,15 +7159,15 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_set(struct __pyx_obj_4cdec_2sa_3_sa_
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
__Pyx_WriteUnraisable("cdec.sa._sa.IntList.set", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":119
+/* "cdec/sa/int_list.pxi":119
* self.arr[j] = val
*
* def __setitem__(self, i, val): # <<<<<<<<<<<<<<
@@ -7070,7 +7198,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":120
+ /* "cdec/sa/int_list.pxi":120
*
* def __setitem__(self, i, val):
* self.set(i, val) # <<<<<<<<<<<<<<
@@ -7081,7 +7209,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec
__pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_val); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":119
+ /* "cdec/sa/int_list.pxi":119
* self.arr[j] = val
*
* def __setitem__(self, i, val): # <<<<<<<<<<<<<<
@@ -7100,7 +7228,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":122
+/* "cdec/sa/int_list.pxi":122
* self.set(i, val)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -7126,7 +7254,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4c
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":123
+ /* "cdec/sa/int_list.pxi":123
*
* def __len__(self):
* return self.len # <<<<<<<<<<<<<<
@@ -7136,7 +7264,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4c
__pyx_r = __pyx_v_self->len;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":122
+ /* "cdec/sa/int_list.pxi":122
* self.set(i, val)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -7150,7 +7278,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":125
+/* "cdec/sa/int_list.pxi":125
* return self.len
*
* def get_size(self): # <<<<<<<<<<<<<<
@@ -7180,7 +7308,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_size", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":126
+ /* "cdec/sa/int_list.pxi":126
*
* def get_size(self):
* return self.size # <<<<<<<<<<<<<<
@@ -7194,7 +7322,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4c
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":125
+ /* "cdec/sa/int_list.pxi":125
* return self.len
*
* def get_size(self): # <<<<<<<<<<<<<<
@@ -7213,7 +7341,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":128
+/* "cdec/sa/int_list.pxi":128
* return self.size
*
* def append(self, int val): # <<<<<<<<<<<<<<
@@ -7252,7 +7380,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cde
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("append", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":129
+ /* "cdec/sa/int_list.pxi":129
*
* def append(self, int val):
* self._append(val) # <<<<<<<<<<<<<<
@@ -7261,7 +7389,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cde
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":128
+ /* "cdec/sa/int_list.pxi":128
* return self.size
*
* def append(self, int val): # <<<<<<<<<<<<<<
@@ -7276,7 +7404,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":131
+/* "cdec/sa/int_list.pxi":131
* self._append(val)
*
* cdef void _append(self, int val): # <<<<<<<<<<<<<<
@@ -7289,7 +7417,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
int __pyx_t_1;
__Pyx_RefNannySetupContext("_append", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":132
+ /* "cdec/sa/int_list.pxi":132
*
* cdef void _append(self, int val):
* if self.len == self.size: # <<<<<<<<<<<<<<
@@ -7299,7 +7427,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
__pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":133
+ /* "cdec/sa/int_list.pxi":133
* cdef void _append(self, int val):
* if self.len == self.size:
* self.size = self.size + self.increment # <<<<<<<<<<<<<<
@@ -7308,7 +7436,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":134
+ /* "cdec/sa/int_list.pxi":134
* if self.len == self.size:
* self.size = self.size + self.increment
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<<
@@ -7320,7 +7448,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":135
+ /* "cdec/sa/int_list.pxi":135
* self.size = self.size + self.increment
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int))
* self.arr[self.len] = val # <<<<<<<<<<<<<<
@@ -7329,7 +7457,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":136
+ /* "cdec/sa/int_list.pxi":136
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int))
* self.arr[self.len] = val
* self.len = self.len + 1 # <<<<<<<<<<<<<<
@@ -7338,7 +7466,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_self->len = (__pyx_v_self->len + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":131
+ /* "cdec/sa/int_list.pxi":131
* self._append(val)
*
* cdef void _append(self, int val): # <<<<<<<<<<<<<<
@@ -7350,7 +7478,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__append(struct __pyx_obj_4cdec_2sa_3
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":138
+/* "cdec/sa/int_list.pxi":138
* self.len = self.len + 1
*
* def extend(self, other): # <<<<<<<<<<<<<<
@@ -7379,7 +7507,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("extend", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":139
+ /* "cdec/sa/int_list.pxi":139
*
* def extend(self, other):
* self._extend(other) # <<<<<<<<<<<<<<
@@ -7389,7 +7517,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cde
if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_other));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":138
+ /* "cdec/sa/int_list.pxi":138
* self.len = self.len + 1
*
* def extend(self, other): # <<<<<<<<<<<<<<
@@ -7409,7 +7537,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":141
+/* "cdec/sa/int_list.pxi":141
* self._extend(other)
*
* cdef void _extend(self, IntList other): # <<<<<<<<<<<<<<
@@ -7421,7 +7549,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend(struct __pyx_obj_4cdec_2sa_3
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_extend", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":142
+ /* "cdec/sa/int_list.pxi":142
*
* cdef void _extend(self, IntList other):
* self._extend_arr(other.arr, other.len) # <<<<<<<<<<<<<<
@@ -7430,7 +7558,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend(struct __pyx_obj_4cdec_2sa_3
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend_arr(__pyx_v_self, __pyx_v_other->arr, __pyx_v_other->len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":141
+ /* "cdec/sa/int_list.pxi":141
* self._extend(other)
*
* cdef void _extend(self, IntList other): # <<<<<<<<<<<<<<
@@ -7442,7 +7570,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend(struct __pyx_obj_4cdec_2sa_3
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":144
+/* "cdec/sa/int_list.pxi":144
* self._extend_arr(other.arr, other.len)
*
* cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<<
@@ -7455,7 +7583,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
int __pyx_t_1;
__Pyx_RefNannySetupContext("_extend_arr", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":145
+ /* "cdec/sa/int_list.pxi":145
*
* cdef void _extend_arr(self, int* other, int other_len):
* if self.size < self.len + other_len: # <<<<<<<<<<<<<<
@@ -7465,7 +7593,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
__pyx_t_1 = ((__pyx_v_self->size < (__pyx_v_self->len + __pyx_v_other_len)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":146
+ /* "cdec/sa/int_list.pxi":146
* cdef void _extend_arr(self, int* other, int other_len):
* if self.size < self.len + other_len:
* self.size = self.len + other_len # <<<<<<<<<<<<<<
@@ -7474,7 +7602,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->size = (__pyx_v_self->len + __pyx_v_other_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":147
+ /* "cdec/sa/int_list.pxi":147
* if self.size < self.len + other_len:
* self.size = self.len + other_len
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<<
@@ -7486,7 +7614,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":148
+ /* "cdec/sa/int_list.pxi":148
* self.size = self.len + other_len
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int))
* memcpy(self.arr+self.len, other, other_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -7495,7 +7623,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
*/
memcpy((__pyx_v_self->arr + __pyx_v_self->len), __pyx_v_other, (__pyx_v_other_len * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":149
+ /* "cdec/sa/int_list.pxi":149
* self.arr = <int*> realloc(self.arr, self.size*sizeof(int))
* memcpy(self.arr+self.len, other, other_len*sizeof(int))
* self.len = self.len + other_len # <<<<<<<<<<<<<<
@@ -7504,7 +7632,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->len = (__pyx_v_self->len + __pyx_v_other_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":144
+ /* "cdec/sa/int_list.pxi":144
* self._extend_arr(other.arr, other.len)
*
* cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<<
@@ -7516,7 +7644,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr(struct __pyx_obj_4cdec_2
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":151
+/* "cdec/sa/int_list.pxi":151
* self.len = self.len + other_len
*
* cdef void _clear(self): # <<<<<<<<<<<<<<
@@ -7528,7 +7656,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_clear", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":152
+ /* "cdec/sa/int_list.pxi":152
*
* cdef void _clear(self):
* free(self.arr) # <<<<<<<<<<<<<<
@@ -7537,7 +7665,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
*/
free(__pyx_v_self->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":153
+ /* "cdec/sa/int_list.pxi":153
* cdef void _clear(self):
* free(self.arr)
* self.len = 0 # <<<<<<<<<<<<<<
@@ -7546,7 +7674,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
*/
__pyx_v_self->len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":154
+ /* "cdec/sa/int_list.pxi":154
* free(self.arr)
* self.len = 0
* self.size = 0 # <<<<<<<<<<<<<<
@@ -7555,7 +7683,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
*/
__pyx_v_self->size = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":155
+ /* "cdec/sa/int_list.pxi":155
* self.len = 0
* self.size = 0
* self.arr = <int*> malloc(0) # <<<<<<<<<<<<<<
@@ -7564,7 +7692,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
*/
__pyx_v_self->arr = ((int *)malloc(0));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":151
+ /* "cdec/sa/int_list.pxi":151
* self.len = self.len + other_len
*
* cdef void _clear(self): # <<<<<<<<<<<<<<
@@ -7576,7 +7704,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":157
+/* "cdec/sa/int_list.pxi":157
* self.arr = <int*> malloc(0)
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -7588,7 +7716,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_write_handle(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":158
+ /* "cdec/sa/int_list.pxi":158
*
* cdef void write_handle(self, FILE* f):
* fwrite(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -7597,7 +7725,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_write_handle(struct __pyx_obj_4cdec_
*/
fwrite((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":159
+ /* "cdec/sa/int_list.pxi":159
* cdef void write_handle(self, FILE* f):
* fwrite(&(self.len), sizeof(int), 1, f)
* fwrite(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<<
@@ -7606,7 +7734,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_write_handle(struct __pyx_obj_4cdec_
*/
fwrite(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":157
+ /* "cdec/sa/int_list.pxi":157
* self.arr = <int*> malloc(0)
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -7618,7 +7746,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_write_handle(struct __pyx_obj_4cdec_
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":161
+/* "cdec/sa/int_list.pxi":161
* fwrite(self.arr, sizeof(int), self.len, f)
*
* def write(self, char* filename): # <<<<<<<<<<<<<<
@@ -7658,7 +7786,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":163
+ /* "cdec/sa/int_list.pxi":163
* def write(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -7667,7 +7795,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":164
+ /* "cdec/sa/int_list.pxi":164
* cdef FILE* f
* f = fopen(filename, "w")
* self.write_handle(f) # <<<<<<<<<<<<<<
@@ -7676,7 +7804,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":165
+ /* "cdec/sa/int_list.pxi":165
* f = fopen(filename, "w")
* self.write_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -7685,7 +7813,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":161
+ /* "cdec/sa/int_list.pxi":161
* fwrite(self.arr, sizeof(int), self.len, f)
*
* def write(self, char* filename): # <<<<<<<<<<<<<<
@@ -7700,7 +7828,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":167
+/* "cdec/sa/int_list.pxi":167
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -7713,7 +7841,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
int __pyx_t_1;
__Pyx_RefNannySetupContext("read_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":168
+ /* "cdec/sa/int_list.pxi":168
*
* cdef void read_handle(self, FILE* f):
* (self.arr) # <<<<<<<<<<<<<<
@@ -7722,7 +7850,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->arr;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":169
+ /* "cdec/sa/int_list.pxi":169
* cdef void read_handle(self, FILE* f):
* (self.arr)
* fread(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -7731,7 +7859,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
*/
fread((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":170
+ /* "cdec/sa/int_list.pxi":170
* (self.arr)
* fread(&(self.len), sizeof(int), 1, f)
* self.arr = <int*> malloc(self.len * sizeof(int)) # <<<<<<<<<<<<<<
@@ -7740,7 +7868,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->arr = ((int *)malloc((__pyx_v_self->len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":171
+ /* "cdec/sa/int_list.pxi":171
* fread(&(self.len), sizeof(int), 1, f)
* self.arr = <int*> malloc(self.len * sizeof(int))
* self.size = self.len # <<<<<<<<<<<<<<
@@ -7750,7 +7878,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
__pyx_t_1 = __pyx_v_self->len;
__pyx_v_self->size = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":172
+ /* "cdec/sa/int_list.pxi":172
* self.arr = <int*> malloc(self.len * sizeof(int))
* self.size = self.len
* fread(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<<
@@ -7759,7 +7887,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
*/
fread(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":167
+ /* "cdec/sa/int_list.pxi":167
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -7771,7 +7899,7 @@ static void __pyx_f_4cdec_2sa_3_sa_7IntList_read_handle(struct __pyx_obj_4cdec_2
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":174
+/* "cdec/sa/int_list.pxi":174
* fread(self.arr, sizeof(int), self.len, f)
*
* def read(self, char* filename): # <<<<<<<<<<<<<<
@@ -7811,7 +7939,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":176
+ /* "cdec/sa/int_list.pxi":176
* def read(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -7820,7 +7948,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":177
+ /* "cdec/sa/int_list.pxi":177
* cdef FILE* f
* f = fopen(filename, "r")
* self.read_handle(f) # <<<<<<<<<<<<<<
@@ -7828,14 +7956,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":178
+ /* "cdec/sa/int_list.pxi":178
* f = fopen(filename, "r")
* self.read_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":174
+ /* "cdec/sa/int_list.pxi":174
* fread(self.arr, sizeof(int), self.len, f)
*
* def read(self, char* filename): # <<<<<<<<<<<<<<
@@ -7850,7 +7978,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":13
+/* "cdec/sa/str_map.pxi":13
* cdef int index(self, char *s)
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -7879,7 +8007,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":14
+ /* "cdec/sa/str_map.pxi":14
*
* def __cinit__(self):
* self.vocab = stringmap_new() # <<<<<<<<<<<<<<
@@ -7888,7 +8016,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->vocab = stringmap_new();
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":13
+ /* "cdec/sa/str_map.pxi":13
* cdef int index(self, char *s)
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -7902,7 +8030,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":16
+/* "cdec/sa/str_map.pxi":16
* self.vocab = stringmap_new()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7925,7 +8053,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":17
+ /* "cdec/sa/str_map.pxi":17
*
* def __dealloc__(self):
* stringmap_delete(self.vocab) # <<<<<<<<<<<<<<
@@ -7934,7 +8062,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cd
*/
stringmap_delete(__pyx_v_self->vocab);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":16
+ /* "cdec/sa/str_map.pxi":16
* self.vocab = stringmap_new()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -7946,7 +8074,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cd
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":19
+/* "cdec/sa/str_map.pxi":19
* stringmap_delete(self.vocab)
*
* cdef char *word(self, int i): # <<<<<<<<<<<<<<
@@ -7959,7 +8087,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_9StringMap_word(struct __pyx_obj_4cdec_2sa_3
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("word", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":20
+ /* "cdec/sa/str_map.pxi":20
*
* cdef char *word(self, int i):
* return stringmap_word(self.vocab, i) # <<<<<<<<<<<<<<
@@ -7969,7 +8097,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_9StringMap_word(struct __pyx_obj_4cdec_2sa_3
__pyx_r = stringmap_word(__pyx_v_self->vocab, __pyx_v_i);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":19
+ /* "cdec/sa/str_map.pxi":19
* stringmap_delete(self.vocab)
*
* cdef char *word(self, int i): # <<<<<<<<<<<<<<
@@ -7983,7 +8111,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_9StringMap_word(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":22
+/* "cdec/sa/str_map.pxi":22
* return stringmap_word(self.vocab, i)
*
* cdef int index(self, char *s): # <<<<<<<<<<<<<<
@@ -7995,7 +8123,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9StringMap_index(struct __pyx_obj_4cdec_2sa_3_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("index", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":23
+ /* "cdec/sa/str_map.pxi":23
*
* cdef int index(self, char *s):
* return stringmap_index(self.vocab, s) # <<<<<<<<<<<<<<
@@ -8003,7 +8131,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9StringMap_index(struct __pyx_obj_4cdec_2sa_3_
__pyx_r = stringmap_index(__pyx_v_self->vocab, __pyx_v_s);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":22
+ /* "cdec/sa/str_map.pxi":22
* return stringmap_word(self.vocab, i)
*
* cdef int index(self, char *s): # <<<<<<<<<<<<<<
@@ -8016,7 +8144,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9StringMap_index(struct __pyx_obj_4cdec_2sa_3_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":17
+/* "cdec/sa/data_array.pxi":17
* cdef bint use_sent_id
*
* def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): # <<<<<<<<<<<<<<
@@ -8121,12 +8249,15 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":18
+ /* "cdec/sa/data_array.pxi":18
*
* def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False):
* self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} # <<<<<<<<<<<<<<
@@ -8143,7 +8274,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_v_self->word2id = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":19
+ /* "cdec/sa/data_array.pxi":19
* def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False):
* self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1}
* self.id2word = ["END_OF_FILE", "END_OF_LINE"] # <<<<<<<<<<<<<<
@@ -8164,7 +8295,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_v_self->id2word = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":20
+ /* "cdec/sa/data_array.pxi":20
* self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1}
* self.id2word = ["END_OF_FILE", "END_OF_LINE"]
* self.data = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -8179,7 +8310,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":21
+ /* "cdec/sa/data_array.pxi":21
* self.id2word = ["END_OF_FILE", "END_OF_LINE"]
* self.data = IntList(1000,1000)
* self.sent_id = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -8194,7 +8325,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22
+ /* "cdec/sa/data_array.pxi":22
* self.data = IntList(1000,1000)
* self.sent_id = IntList(1000,1000)
* self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -8209,7 +8340,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":23
+ /* "cdec/sa/data_array.pxi":23
* self.sent_id = IntList(1000,1000)
* self.sent_index = IntList(1000,1000)
* self.use_sent_id = use_sent_id # <<<<<<<<<<<<<<
@@ -8218,7 +8349,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->use_sent_id = __pyx_v_use_sent_id;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":24
+ /* "cdec/sa/data_array.pxi":24
* self.sent_index = IntList(1000,1000)
* self.use_sent_id = use_sent_id
* if from_binary: # <<<<<<<<<<<<<<
@@ -8228,29 +8359,45 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":25
+ /* "cdec/sa/data_array.pxi":25
* self.use_sent_id = use_sent_id
* if from_binary:
* self.read_binary(from_binary) # <<<<<<<<<<<<<<
* elif from_text:
* if side:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_binary);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary);
- __Pyx_GIVEREF(__pyx_v_from_binary);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_from_binary);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_from_binary);
+ __Pyx_GIVEREF(__pyx_v_from_binary);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":26
+ /* "cdec/sa/data_array.pxi":26
* if from_binary:
* self.read_binary(from_binary)
* elif from_text: # <<<<<<<<<<<<<<
@@ -8260,7 +8407,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":27
+ /* "cdec/sa/data_array.pxi":27
* self.read_binary(from_binary)
* elif from_text:
* if side: # <<<<<<<<<<<<<<
@@ -8270,41 +8417,56 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_side); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":28
+ /* "cdec/sa/data_array.pxi":28
* elif from_text:
* if side:
* self.read_bitext(from_text, (0 if side == 'source' else 1)) # <<<<<<<<<<<<<<
* else:
* self.read_text(from_text)
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_bitext); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_bitext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_side, __pyx_n_s_source, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_int_0);
- __pyx_t_3 = __pyx_int_0;
+ __pyx_t_5 = __pyx_int_0;
} else {
__Pyx_INCREF(__pyx_int_1);
- __pyx_t_3 = __pyx_int_1;
+ __pyx_t_5 = __pyx_int_1;
+ }
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
}
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_from_text);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_from_text);
__Pyx_GIVEREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L4;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":30
+ /* "cdec/sa/data_array.pxi":30
* self.read_bitext(from_text, (0 if side == 'source' else 1))
* else:
* self.read_text(from_text) # <<<<<<<<<<<<<<
@@ -8313,23 +8475,39 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_from_text);
- __Pyx_GIVEREF(__pyx_v_from_text);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_v_from_text);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_from_text);
+ __Pyx_GIVEREF(__pyx_v_from_text);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L4:;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":17
+ /* "cdec/sa/data_array.pxi":17
* cdef bint use_sent_id
*
* def __cinit__(self, from_binary=None, from_text=None, side=None, bint use_sent_id=False): # <<<<<<<<<<<<<<
@@ -8344,6 +8522,8 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -8351,7 +8531,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":32
+/* "cdec/sa/data_array.pxi":32
* self.read_text(from_text)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -8382,7 +8562,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":33
+ /* "cdec/sa/data_array.pxi":33
*
* def __len__(self):
* return len(self.data) # <<<<<<<<<<<<<<
@@ -8396,7 +8576,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4
__pyx_r = __pyx_t_2;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":32
+ /* "cdec/sa/data_array.pxi":32
* self.read_text(from_text)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -8414,7 +8594,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":35
+/* "cdec/sa/data_array.pxi":35
* return len(self.data)
*
* def get_sentence_id(self, i): # <<<<<<<<<<<<<<
@@ -8445,7 +8625,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_sentence_id", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":36
+ /* "cdec/sa/data_array.pxi":36
*
* def get_sentence_id(self, i):
* return self.sent_id.arr[i] # <<<<<<<<<<<<<<
@@ -8460,7 +8640,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __py
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":35
+ /* "cdec/sa/data_array.pxi":35
* return len(self.data)
*
* def get_sentence_id(self, i): # <<<<<<<<<<<<<<
@@ -8479,7 +8659,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":38
+/* "cdec/sa/data_array.pxi":38
* return self.sent_id.arr[i]
*
* def get_sentence(self, i): # <<<<<<<<<<<<<<
@@ -8517,7 +8697,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__Pyx_RefNannySetupContext("get_sentence", 0);
__Pyx_INCREF(__pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":40
+ /* "cdec/sa/data_array.pxi":40
* def get_sentence(self, i):
* cdef int j, start, stop
* sent = [] # <<<<<<<<<<<<<<
@@ -8529,7 +8709,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__pyx_v_sent = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":41
+ /* "cdec/sa/data_array.pxi":41
* cdef int j, start, stop
* sent = []
* start = self.sent_index.arr[i] # <<<<<<<<<<<<<<
@@ -8539,7 +8719,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_t_2]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":42
+ /* "cdec/sa/data_array.pxi":42
* sent = []
* start = self.sent_index.arr[i]
* stop = self.sent_index.arr[i+1] # <<<<<<<<<<<<<<
@@ -8552,7 +8732,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_stop = (__pyx_v_self->sent_index->arr[__pyx_t_2]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":43
+ /* "cdec/sa/data_array.pxi":43
* start = self.sent_index.arr[i]
* stop = self.sent_index.arr[i+1]
* for i from start <= i < stop: # <<<<<<<<<<<<<<
@@ -8566,7 +8746,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":44
+ /* "cdec/sa/data_array.pxi":44
* stop = self.sent_index.arr[i+1]
* for i from start <= i < stop:
* sent.append(self.id2word[self.data.arr[i]]) # <<<<<<<<<<<<<<
@@ -8581,7 +8761,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":43
+ /* "cdec/sa/data_array.pxi":43
* start = self.sent_index.arr[i]
* stop = self.sent_index.arr[i+1]
* for i from start <= i < stop: # <<<<<<<<<<<<<<
@@ -8593,7 +8773,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":45
+ /* "cdec/sa/data_array.pxi":45
* for i from start <= i < stop:
* sent.append(self.id2word[self.data.arr[i]])
* return sent # <<<<<<<<<<<<<<
@@ -8605,7 +8785,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
__pyx_r = __pyx_v_sent;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":38
+ /* "cdec/sa/data_array.pxi":38
* return self.sent_id.arr[i]
*
* def get_sentence(self, i): # <<<<<<<<<<<<<<
@@ -8626,7 +8806,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":47
+/* "cdec/sa/data_array.pxi":47
* return sent
*
* def get_id(self, word): # <<<<<<<<<<<<<<
@@ -8660,7 +8840,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_id", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":48
+ /* "cdec/sa/data_array.pxi":48
*
* def get_id(self, word):
* if not word in self.word2id: # <<<<<<<<<<<<<<
@@ -8671,7 +8851,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":49
+ /* "cdec/sa/data_array.pxi":49
* def get_id(self, word):
* if not word in self.word2id:
* self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<<
@@ -8687,7 +8867,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
if (unlikely(PyObject_SetItem(__pyx_v_self->word2id, __pyx_v_word, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":50
+ /* "cdec/sa/data_array.pxi":50
* if not word in self.word2id:
* self.word2id[word] = len(self.id2word)
* self.id2word.append(word) # <<<<<<<<<<<<<<
@@ -8699,7 +8879,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":51
+ /* "cdec/sa/data_array.pxi":51
* self.word2id[word] = len(self.id2word)
* self.id2word.append(word)
* return self.word2id[word] # <<<<<<<<<<<<<<
@@ -8713,7 +8893,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":47
+ /* "cdec/sa/data_array.pxi":47
* return sent
*
* def get_id(self, word): # <<<<<<<<<<<<<<
@@ -8732,7 +8912,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":53
+/* "cdec/sa/data_array.pxi":53
* return self.word2id[word]
*
* def __getitem__(self, loc): # <<<<<<<<<<<<<<
@@ -8763,7 +8943,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":54
+ /* "cdec/sa/data_array.pxi":54
*
* def __getitem__(self, loc):
* return self.id2word[self.data.arr[loc]] # <<<<<<<<<<<<<<
@@ -8778,7 +8958,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_o
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":53
+ /* "cdec/sa/data_array.pxi":53
* return self.word2id[word]
*
* def __getitem__(self, loc): # <<<<<<<<<<<<<<
@@ -8797,7 +8977,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":56
+/* "cdec/sa/data_array.pxi":56
* return self.id2word[self.data.arr[loc]]
*
* def get_sentence_bounds(self, loc): # <<<<<<<<<<<<<<
@@ -8831,7 +9011,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_sentence_bounds", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":57
+ /* "cdec/sa/data_array.pxi":57
*
* def get_sentence_bounds(self, loc):
* cdef int sid = self.sent_id.arr[loc] # <<<<<<<<<<<<<<
@@ -8841,7 +9021,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct
__pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loc); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_sid = (__pyx_v_self->sent_id->arr[__pyx_t_1]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":58
+ /* "cdec/sa/data_array.pxi":58
* def get_sentence_bounds(self, loc):
* cdef int sid = self.sent_id.arr[loc]
* return (self.sent_index.arr[sid], self.sent_index.arr[sid+1]) # <<<<<<<<<<<<<<
@@ -8865,7 +9045,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct
__pyx_t_4 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":56
+ /* "cdec/sa/data_array.pxi":56
* return self.id2word[self.data.arr[loc]]
*
* def get_sentence_bounds(self, loc): # <<<<<<<<<<<<<<
@@ -8886,7 +9066,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":60
+/* "cdec/sa/data_array.pxi":60
* return (self.sent_index.arr[sid], self.sent_index.arr[sid+1])
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -8932,19 +9112,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
+ int __pyx_t_11;
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
- int __pyx_t_14;
+ PyObject *__pyx_t_14 = NULL;
+ PyObject *__pyx_t_15 = NULL;
+ int __pyx_t_16;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61
+ /* "cdec/sa/data_array.pxi":61
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -8967,55 +9149,73 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":62
+ /* "cdec/sa/data_array.pxi":62
* def write_text(self, char* filename):
* with open(filename, "w") as f:
* for w_id in self.data: # <<<<<<<<<<<<<<
* if w_id > 1:
* f.write("%s " % self.get_word(w_id))
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->data)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) {
- __pyx_t_4 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->data))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) {
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->data)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->data)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_9(__pyx_t_4);
+ __pyx_t_1 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -9029,7 +9229,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
__Pyx_XDECREF_SET(__pyx_v_w_id, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":63
+ /* "cdec/sa/data_array.pxi":63
* with open(filename, "w") as f:
* for w_id in self.data:
* if w_id > 1: # <<<<<<<<<<<<<<
@@ -9037,90 +9237,133 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
* if w_id == 1:
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_10) {
+ if (__pyx_t_11) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":64
+ /* "cdec/sa/data_array.pxi":64
* for w_id in self.data:
* if w_id > 1:
* f.write("%s " % self.get_word(w_id)) # <<<<<<<<<<<<<<
* if w_id == 1:
* f.write("\n")
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_INCREF(__pyx_v_w_id);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_w_id);
- __Pyx_GIVEREF(__pyx_v_w_id);
- __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_word); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_13 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_13)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_13);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (!__pyx_t_13) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_w_id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL;
+ __Pyx_INCREF(__pyx_v_w_id);
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_w_id);
+ __Pyx_GIVEREF(__pyx_v_w_id);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- goto __pyx_L18;
+ goto __pyx_L17;
}
- __pyx_L18:;
+ __pyx_L17:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":65
+ /* "cdec/sa/data_array.pxi":65
* if w_id > 1:
* f.write("%s " % self.get_word(w_id))
* if w_id == 1: # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_11 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_10) {
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_w_id, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_11) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":66
+ /* "cdec/sa/data_array.pxi":66
* f.write("%s " % self.get_word(w_id))
* if w_id == 1:
* f.write("\n") # <<<<<<<<<<<<<<
*
* def read_text(self, char* filename):
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- goto __pyx_L19;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L18;
}
- __pyx_L19:;
+ __pyx_L18:;
+
+ /* "cdec/sa/data_array.pxi":62
+ * def write_text(self, char* filename):
+ * with open(filename, "w") as f:
+ * for w_id in self.data: # <<<<<<<<<<<<<<
+ * if w_id > 1:
+ * f.write("%s " % self.get_word(w_id))
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61
+ /* "cdec/sa/data_array.pxi":61
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -9129,69 +9372,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_12, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL);
+ __pyx_t_14 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_14 = ((!(__pyx_t_10 != 0)) != 0);
- if (__pyx_t_14) {
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_16 = ((!(__pyx_t_11 != 0)) != 0);
+ if (__pyx_t_16) {
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_12);
- __Pyx_XGIVEREF(__pyx_t_11);
- __Pyx_ErrRestore(__pyx_t_4, __pyx_t_12, __pyx_t_11);
- __pyx_t_4 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0;
+ __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_2, __pyx_t_1);
+ __pyx_t_4 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L23;
+ goto __pyx_L22;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":60
+ /* "cdec/sa/data_array.pxi":60
* return (self.sent_index.arr[sid], self.sent_index.arr[sid+1])
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -9206,8 +9449,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
+ __Pyx_XDECREF(__pyx_t_14);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -9218,7 +9463,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":68
+/* "cdec/sa/data_array.pxi":68
* f.write("\n")
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -9265,14 +9510,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
- int __pyx_t_10;
+ PyObject *__pyx_t_10 = NULL;
int __pyx_t_11;
+ int __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69
+ /* "cdec/sa/data_array.pxi":69
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -9280,39 +9526,72 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
*
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
- __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_v_fp = __pyx_t_1;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_fp = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":70
+ /* "cdec/sa/data_array.pxi":70
* def read_text(self, char* filename):
* with gzip_or_text(filename) as fp:
* self.read_text_data(fp) # <<<<<<<<<<<<<<
@@ -9321,27 +9600,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_fp);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fp);
- __Pyx_GIVEREF(__pyx_v_fp);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_fp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_INCREF(__pyx_v_fp);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_fp);
+ __Pyx_GIVEREF(__pyx_v_fp);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69
+ /* "cdec/sa/data_array.pxi":69
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -9350,69 +9647,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
- if (__pyx_t_11) {
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_XGIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
- __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
+ if (__pyx_t_12) {
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ErrRestore(__pyx_t_5, __pyx_t_1, __pyx_t_3);
+ __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
- if (__pyx_t_4) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__9, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_6) {
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L19;
+ goto __pyx_L18;
__pyx_L3_error:;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L1_error;
- __pyx_L19:;
+ __pyx_L18:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":68
+ /* "cdec/sa/data_array.pxi":68
* f.write("\n")
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -9427,7 +9724,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -9437,7 +9735,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72
+/* "cdec/sa/data_array.pxi":72
* self.read_text_data(fp)
*
* def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<<
@@ -9505,9 +9803,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":74
+/* "cdec/sa/data_array.pxi":74
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp:
* data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<<
@@ -9533,26 +9831,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObje
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator7, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_read_bitext_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -9576,29 +9871,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6(__
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) { __Pyx_RaiseClosureNameError("fp"); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -9660,7 +9957,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_9DataArray_11read_bitext_2generator6(__
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72
+/* "cdec/sa/data_array.pxi":72
* self.read_text_data(fp)
*
* def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<<
@@ -9682,8 +9979,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
- int __pyx_t_10;
+ PyObject *__pyx_t_10 = NULL;
int __pyx_t_11;
+ int __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -9696,7 +9994,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
__Pyx_GOTREF(__pyx_cur_scope);
__pyx_cur_scope->__pyx_v_side = __pyx_v_side;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73
+ /* "cdec/sa/data_array.pxi":73
*
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -9704,52 +10002,85 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
* self.read_text_data(data)
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
- __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_fp = __pyx_t_1;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_cur_scope->__pyx_v_fp = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":74
+ /* "cdec/sa/data_array.pxi":74
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp:
* data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<<
* self.read_text_data(data)
*
*/
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_v_data = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_5 = __pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_v_data = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":75
+ /* "cdec/sa/data_array.pxi":75
* with gzip_or_text(filename) as fp:
* data = (line.split(' ||| ')[side] for line in fp)
* self.read_text_data(data) # <<<<<<<<<<<<<<
@@ -9758,27 +10089,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_data);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
- __Pyx_GIVEREF(__pyx_v_data);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_INCREF(__pyx_v_data);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_data);
+ __Pyx_GIVEREF(__pyx_v_data);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73
+ /* "cdec/sa/data_array.pxi":73
*
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -9787,69 +10136,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = PyTuple_Pack(3, __pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
- if (__pyx_t_11) {
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_XGIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
- __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
+ if (__pyx_t_12) {
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ErrRestore(__pyx_t_5, __pyx_t_1, __pyx_t_3);
+ __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
- if (__pyx_t_4) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__12, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_6) {
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__12, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L19;
+ goto __pyx_L18;
__pyx_L3_error:;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L1_error;
- __pyx_L19:;
+ __pyx_L18:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72
+ /* "cdec/sa/data_array.pxi":72
* self.read_text_data(fp)
*
* def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<<
@@ -9864,7 +10213,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -9875,7 +10225,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":77
+/* "cdec/sa/data_array.pxi":77
* self.read_text_data(data)
*
* def read_text_data(self, data): # <<<<<<<<<<<<<<
@@ -9910,17 +10260,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
- int __pyx_t_12;
+ PyObject *__pyx_t_12 = NULL;
+ int __pyx_t_13;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_text_data", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":78
+ /* "cdec/sa/data_array.pxi":78
*
* def read_text_data(self, data):
* cdef int word_count = 0 # <<<<<<<<<<<<<<
@@ -9929,7 +10280,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
*/
__pyx_v_word_count = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":79
+ /* "cdec/sa/data_array.pxi":79
* def read_text_data(self, data):
* cdef int word_count = 0
* for line_num, line in enumerate(data): # <<<<<<<<<<<<<<
@@ -9938,29 +10289,31 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) {
+ if (likely(PyList_CheckExact(__pyx_v_data)) || PyTuple_CheckExact(__pyx_v_data)) {
__pyx_t_2 = __pyx_v_data; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_5 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_5)) {
@@ -9983,7 +10336,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
__pyx_t_1 = __pyx_t_5;
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":80
+ /* "cdec/sa/data_array.pxi":80
* cdef int word_count = 0
* for line_num, line in enumerate(data):
* self.sent_index.append(word_count) # <<<<<<<<<<<<<<
@@ -9995,45 +10348,62 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
__pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":81
+ /* "cdec/sa/data_array.pxi":81
* for line_num, line in enumerate(data):
* self.sent_index.append(word_count)
* for word in line.split(): # <<<<<<<<<<<<<<
* self.data.append(self.get_id(word))
* if self.use_sent_id:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
- __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
} else {
- __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
+ __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
+ } else {
+ __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_7))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_7 = __pyx_t_9(__pyx_t_5);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_5 = __pyx_t_10(__pyx_t_7);
+ if (unlikely(!__pyx_t_5)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -10041,43 +10411,59 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_5);
}
- __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_7);
- __pyx_t_7 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":82
+ /* "cdec/sa/data_array.pxi":82
* self.sent_index.append(word_count)
* for word in line.split():
* self.data.append(self.get_id(word)) # <<<<<<<<<<<<<<
* if self.use_sent_id:
* self.sent_id.append(line_num)
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_id); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_INCREF(__pyx_v_word);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_word);
- __Pyx_GIVEREF(__pyx_v_word);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_t_11); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_id); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_8, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_word); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ __Pyx_INCREF(__pyx_v_word);
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_v_word);
+ __Pyx_GIVEREF(__pyx_v_word);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":83
+ /* "cdec/sa/data_array.pxi":83
* for word in line.split():
* self.data.append(self.get_id(word))
* if self.use_sent_id: # <<<<<<<<<<<<<<
* self.sent_id.append(line_num)
* word_count = word_count + 1
*/
- __pyx_t_12 = (__pyx_v_self->use_sent_id != 0);
- if (__pyx_t_12) {
+ __pyx_t_13 = (__pyx_v_self->use_sent_id != 0);
+ if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":84
+ /* "cdec/sa/data_array.pxi":84
* self.data.append(self.get_id(word))
* if self.use_sent_id:
* self.sent_id.append(line_num) # <<<<<<<<<<<<<<
@@ -10089,7 +10475,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
}
__pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":85
+ /* "cdec/sa/data_array.pxi":85
* if self.use_sent_id:
* self.sent_id.append(line_num)
* word_count = word_count + 1 # <<<<<<<<<<<<<<
@@ -10097,10 +10483,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
* if self.use_sent_id:
*/
__pyx_v_word_count = (__pyx_v_word_count + 1);
+
+ /* "cdec/sa/data_array.pxi":81
+ * for line_num, line in enumerate(data):
+ * self.sent_index.append(word_count)
+ * for word in line.split(): # <<<<<<<<<<<<<<
+ * self.data.append(self.get_id(word))
+ * if self.use_sent_id:
+ */
}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":86
+ /* "cdec/sa/data_array.pxi":86
* self.sent_id.append(line_num)
* word_count = word_count + 1
* self.data.append(1) # <<<<<<<<<<<<<<
@@ -10109,17 +10503,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
*/
__pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":87
+ /* "cdec/sa/data_array.pxi":87
* word_count = word_count + 1
* self.data.append(1)
* if self.use_sent_id: # <<<<<<<<<<<<<<
* self.sent_id.append(line_num)
* word_count = word_count + 1
*/
- __pyx_t_12 = (__pyx_v_self->use_sent_id != 0);
- if (__pyx_t_12) {
+ __pyx_t_13 = (__pyx_v_self->use_sent_id != 0);
+ if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":88
+ /* "cdec/sa/data_array.pxi":88
* self.data.append(1)
* if self.use_sent_id:
* self.sent_id.append(line_num) # <<<<<<<<<<<<<<
@@ -10131,7 +10525,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
}
__pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":89
+ /* "cdec/sa/data_array.pxi":89
* if self.use_sent_id:
* self.sent_id.append(line_num)
* word_count = word_count + 1 # <<<<<<<<<<<<<<
@@ -10139,11 +10533,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
* self.sent_index.append(word_count)
*/
__pyx_v_word_count = (__pyx_v_word_count + 1);
+
+ /* "cdec/sa/data_array.pxi":79
+ * def read_text_data(self, data):
+ * cdef int word_count = 0
+ * for line_num, line in enumerate(data): # <<<<<<<<<<<<<<
+ * self.sent_index.append(word_count)
+ * for word in line.split():
+ */
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":90
+ /* "cdec/sa/data_array.pxi":90
* self.sent_id.append(line_num)
* word_count = word_count + 1
* self.data.append(0) # <<<<<<<<<<<<<<
@@ -10152,7 +10554,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
*/
__pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_0); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":91
+ /* "cdec/sa/data_array.pxi":91
* word_count = word_count + 1
* self.data.append(0)
* self.sent_index.append(word_count) # <<<<<<<<<<<<<<
@@ -10164,7 +10566,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
__pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":77
+ /* "cdec/sa/data_array.pxi":77
* self.read_text_data(data)
*
* def read_text_data(self, data): # <<<<<<<<<<<<<<
@@ -10180,8 +10582,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -10193,7 +10596,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":94
+/* "cdec/sa/data_array.pxi":94
*
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -10233,7 +10636,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_o
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":96
+ /* "cdec/sa/data_array.pxi":96
* def read_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -10242,7 +10645,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_o
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":97
+ /* "cdec/sa/data_array.pxi":97
* cdef FILE* f
* f = fopen(filename, "r")
* self.read_handle(f) # <<<<<<<<<<<<<<
@@ -10251,7 +10654,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_o
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":98
+ /* "cdec/sa/data_array.pxi":98
* f = fopen(filename, "r")
* self.read_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -10260,7 +10663,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_o
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":94
+ /* "cdec/sa/data_array.pxi":94
*
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -10275,7 +10678,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":100
+/* "cdec/sa/data_array.pxi":100
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -10301,7 +10704,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":105
+ /* "cdec/sa/data_array.pxi":105
* cdef char* word
*
* self.data.read_handle(f) # <<<<<<<<<<<<<<
@@ -10310,7 +10713,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":106
+ /* "cdec/sa/data_array.pxi":106
*
* self.data.read_handle(f)
* self.sent_index.read_handle(f) # <<<<<<<<<<<<<<
@@ -10319,7 +10722,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":107
+ /* "cdec/sa/data_array.pxi":107
* self.data.read_handle(f)
* self.sent_index.read_handle(f)
* self.sent_id.read_handle(f) # <<<<<<<<<<<<<<
@@ -10328,7 +10731,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->read_handle(__pyx_v_self->sent_id, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":108
+ /* "cdec/sa/data_array.pxi":108
* self.sent_index.read_handle(f)
* self.sent_id.read_handle(f)
* fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -10337,7 +10740,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":109
+ /* "cdec/sa/data_array.pxi":109
* self.sent_id.read_handle(f)
* fread(&(num_words), sizeof(int), 1, f)
* for i in range(num_words): # <<<<<<<<<<<<<<
@@ -10348,7 +10751,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":110
+ /* "cdec/sa/data_array.pxi":110
* fread(&(num_words), sizeof(int), 1, f)
* for i in range(num_words):
* fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -10357,7 +10760,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":111
+ /* "cdec/sa/data_array.pxi":111
* for i in range(num_words):
* fread(&(word_len), sizeof(int), 1, f)
* word = <char*> malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<<
@@ -10366,7 +10769,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
__pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":112
+ /* "cdec/sa/data_array.pxi":112
* fread(&(word_len), sizeof(int), 1, f)
* word = <char*> malloc (word_len * sizeof(char))
* fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<<
@@ -10375,7 +10778,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
*/
fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":113
+ /* "cdec/sa/data_array.pxi":113
* word = <char*> malloc (word_len * sizeof(char))
* fread(word, sizeof(char), word_len, f)
* self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<<
@@ -10394,7 +10797,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":114
+ /* "cdec/sa/data_array.pxi":114
* fread(word, sizeof(char), word_len, f)
* self.word2id[word] = len(self.id2word)
* self.id2word.append(word) # <<<<<<<<<<<<<<
@@ -10406,7 +10809,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
__pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->id2word, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":115
+ /* "cdec/sa/data_array.pxi":115
* self.word2id[word] = len(self.id2word)
* self.id2word.append(word)
* free(word) # <<<<<<<<<<<<<<
@@ -10416,7 +10819,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
free(__pyx_v_word);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":116
+ /* "cdec/sa/data_array.pxi":116
* self.id2word.append(word)
* free(word)
* if len(self.sent_id) == 0: # <<<<<<<<<<<<<<
@@ -10430,7 +10833,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
__pyx_t_7 = ((__pyx_t_4 == 0) != 0);
if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":117
+ /* "cdec/sa/data_array.pxi":117
* free(word)
* if len(self.sent_id) == 0:
* self.use_sent_id = False # <<<<<<<<<<<<<<
@@ -10442,7 +10845,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":119
+ /* "cdec/sa/data_array.pxi":119
* self.use_sent_id = False
* else:
* self.use_sent_id = True # <<<<<<<<<<<<<<
@@ -10453,7 +10856,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":100
+ /* "cdec/sa/data_array.pxi":100
* fclose(f)
*
* cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -10471,7 +10874,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle(struct __pyx_obj_4cdec
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":121
+/* "cdec/sa/data_array.pxi":121
* self.use_sent_id = True
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -10495,7 +10898,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":125
+ /* "cdec/sa/data_array.pxi":125
* cdef int num_words
*
* self.data.write_handle(f) # <<<<<<<<<<<<<<
@@ -10504,7 +10907,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":126
+ /* "cdec/sa/data_array.pxi":126
*
* self.data.write_handle(f)
* self.sent_index.write_handle(f) # <<<<<<<<<<<<<<
@@ -10513,7 +10916,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":127
+ /* "cdec/sa/data_array.pxi":127
* self.data.write_handle(f)
* self.sent_index.write_handle(f)
* self.sent_id.write_handle(f) # <<<<<<<<<<<<<<
@@ -10522,7 +10925,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->write_handle(__pyx_v_self->sent_id, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":128
+ /* "cdec/sa/data_array.pxi":128
* self.sent_index.write_handle(f)
* self.sent_id.write_handle(f)
* num_words = len(self.id2word) - 2 # <<<<<<<<<<<<<<
@@ -10535,7 +10938,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_num_words = (__pyx_t_2 - 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":129
+ /* "cdec/sa/data_array.pxi":129
* self.sent_id.write_handle(f)
* num_words = len(self.id2word) - 2
* fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -10544,7 +10947,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":130
+ /* "cdec/sa/data_array.pxi":130
* num_words = len(self.id2word) - 2
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in self.id2word[2:]: # <<<<<<<<<<<<<<
@@ -10553,30 +10956,32 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
__pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_self->id2word, 2, 0, NULL, NULL, &__pyx_slice__13, 1, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_4(__pyx_t_3);
if (unlikely(!__pyx_t_1)) {
@@ -10592,7 +10997,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
__Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":131
+ /* "cdec/sa/data_array.pxi":131
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in self.id2word[2:]:
* word_len = len(word) + 1 # <<<<<<<<<<<<<<
@@ -10602,7 +11007,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
__pyx_t_5 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_word_len = (__pyx_t_5 + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":132
+ /* "cdec/sa/data_array.pxi":132
* for word in self.id2word[2:]:
* word_len = len(word) + 1
* fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -10611,7 +11016,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":133
+ /* "cdec/sa/data_array.pxi":133
* word_len = len(word) + 1
* fwrite(&(word_len), sizeof(int), 1, f)
* fwrite(<char *>word, sizeof(char), word_len, f) # <<<<<<<<<<<<<<
@@ -10620,10 +11025,18 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
*/
__pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_word); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
fwrite(((char *)__pyx_t_6), (sizeof(char)), __pyx_v_word_len, __pyx_v_f);
+
+ /* "cdec/sa/data_array.pxi":130
+ * num_words = len(self.id2word) - 2
+ * fwrite(&(num_words), sizeof(int), 1, f)
+ * for word in self.id2word[2:]: # <<<<<<<<<<<<<<
+ * word_len = len(word) + 1
+ * fwrite(&(word_len), sizeof(int), 1, f)
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":121
+ /* "cdec/sa/data_array.pxi":121
* self.use_sent_id = True
*
* cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<<
@@ -10642,7 +11055,7 @@ static void __pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle(struct __pyx_obj_4cde
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":135
+/* "cdec/sa/data_array.pxi":135
* fwrite(<char *>word, sizeof(char), word_len, f)
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -10682,7 +11095,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":137
+ /* "cdec/sa/data_array.pxi":137
* def write_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -10691,7 +11104,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":138
+ /* "cdec/sa/data_array.pxi":138
* cdef FILE* f
* f = fopen(filename, "w")
* self.write_handle(f) # <<<<<<<<<<<<<<
@@ -10700,7 +11113,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":139
+ /* "cdec/sa/data_array.pxi":139
* f = fopen(filename, "w")
* self.write_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -10709,7 +11122,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":135
+ /* "cdec/sa/data_array.pxi":135
* fwrite(<char *>word, sizeof(char), word_len, f)
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -10724,7 +11137,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":141
+/* "cdec/sa/data_array.pxi":141
* fclose(f)
*
* def write_enhanced_handle(self, f): # <<<<<<<<<<<<<<
@@ -10756,41 +11169,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_enhanced_handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":142
+ /* "cdec/sa/data_array.pxi":142
*
* def write_enhanced_handle(self, f):
* for i in self.data: # <<<<<<<<<<<<<<
* f.write("%d " %i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->data)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) {
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->data))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->data))) {
__pyx_t_1 = ((PyObject *)__pyx_v_self->data); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->data)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -10806,31 +11223,56 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":143
+ /* "cdec/sa/data_array.pxi":143
* def write_enhanced_handle(self, f):
* for i in self.data:
* f.write("%d " %i) # <<<<<<<<<<<<<<
* f.write("\n")
* for i in self.sent_index:
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/data_array.pxi":142
+ *
+ * def write_enhanced_handle(self, f):
+ * for i in self.data: # <<<<<<<<<<<<<<
+ * f.write("%d " %i)
+ * f.write("\n")
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144
+ /* "cdec/sa/data_array.pxi":144
* for i in self.data:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -10839,43 +11281,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":145
+ /* "cdec/sa/data_array.pxi":145
* f.write("%d " %i)
* f.write("\n")
* for i in self.sent_index: # <<<<<<<<<<<<<<
* f.write("%d " %i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) {
- __pyx_t_5 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) {
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_3(__pyx_t_5);
+ __pyx_t_1 = __pyx_t_3(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -10889,77 +11333,104 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":146
+ /* "cdec/sa/data_array.pxi":146
* f.write("\n")
* for i in self.sent_index:
* f.write("%d " %i) # <<<<<<<<<<<<<<
* f.write("\n")
* for i in self.sent_id:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+
+ /* "cdec/sa/data_array.pxi":145
+ * f.write("%d " %i)
+ * f.write("\n")
+ * for i in self.sent_index: # <<<<<<<<<<<<<<
+ * f.write("%d " %i)
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":147
+ /* "cdec/sa/data_array.pxi":147
* for i in self.sent_index:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
* for i in self.sent_id:
* f.write("%d " %i)
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":148
+ /* "cdec/sa/data_array.pxi":148
* f.write("%d " %i)
* f.write("\n")
* for i in self.sent_id: # <<<<<<<<<<<<<<
* f.write("%d " %i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_id)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_id))) {
- __pyx_t_6 = ((PyObject *)__pyx_v_self->sent_id); __Pyx_INCREF(__pyx_t_6); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->sent_id))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_id))) {
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->sent_id); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_id)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_id)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_5 = __pyx_t_3(__pyx_t_6);
- if (unlikely(!__pyx_t_5)) {
+ __pyx_t_4 = __pyx_t_3(__pyx_t_1);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -10967,12 +11438,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
}
break;
}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
- __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":149
+ /* "cdec/sa/data_array.pxi":149
* f.write("\n")
* for i in self.sent_id:
* f.write("%d " %i) # <<<<<<<<<<<<<<
@@ -10981,68 +11452,95 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
*/
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/data_array.pxi":148
+ * f.write("%d " %i)
+ * f.write("\n")
+ * for i in self.sent_id: # <<<<<<<<<<<<<<
+ * f.write("%d " %i)
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":150
+ /* "cdec/sa/data_array.pxi":150
* for i in self.sent_id:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
* for word in self.id2word:
* f.write("%s %d " % (word, self.word2id[word]))
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":151
+ /* "cdec/sa/data_array.pxi":151
* f.write("%d " %i)
* f.write("\n")
* for word in self.id2word: # <<<<<<<<<<<<<<
* f.write("%s %d " % (word, self.word2id[word]))
* f.write("\n")
*/
- if (PyList_CheckExact(__pyx_v_self->id2word) || PyTuple_CheckExact(__pyx_v_self->id2word)) {
+ if (likely(PyList_CheckExact(__pyx_v_self->id2word)) || PyTuple_CheckExact(__pyx_v_self->id2word)) {
__pyx_t_4 = __pyx_v_self->id2word; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_6 = __pyx_t_3(__pyx_t_4);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_1 = __pyx_t_3(__pyx_t_4);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -11050,47 +11548,72 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_1);
}
- __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_6);
- __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":152
+ /* "cdec/sa/data_array.pxi":152
* f.write("\n")
* for word in self.id2word:
* f.write("%s %d " % (word, self.word2id[word])) # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_word);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_word);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_word);
__Pyx_GIVEREF(__pyx_v_word);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_d, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_s_d, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "cdec/sa/data_array.pxi":151
+ * f.write("%d " %i)
+ * f.write("\n")
+ * for word in self.id2word: # <<<<<<<<<<<<<<
+ * f.write("%s %d " % (word, self.word2id[word]))
+ * f.write("\n")
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153
+ /* "cdec/sa/data_array.pxi":153
* for word in self.id2word:
* f.write("%s %d " % (word, self.word2id[word]))
* f.write("\n") # <<<<<<<<<<<<<<
@@ -11104,7 +11627,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":141
+ /* "cdec/sa/data_array.pxi":141
* fclose(f)
*
* def write_enhanced_handle(self, f): # <<<<<<<<<<<<<<
@@ -11120,6 +11643,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -11130,7 +11655,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(stru
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":155
+/* "cdec/sa/data_array.pxi":155
* f.write("\n")
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -11176,15 +11701,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __py
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
- PyObject *__pyx_t_9 = NULL;
- int __pyx_t_10;
+ Py_ssize_t __pyx_t_9;
+ PyObject *__pyx_t_10 = NULL;
int __pyx_t_11;
+ int __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_enhanced", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156
+ /* "cdec/sa/data_array.pxi":156
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -11206,54 +11732,86 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __py
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":157
+ /* "cdec/sa/data_array.pxi":157
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f:
* self.write_enhanced_handle(self, f) # <<<<<<<<<<<<<<
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_enhanced_handle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write_enhanced_handle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = NULL;
+ __pyx_t_9 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_9 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_2) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ }
__Pyx_INCREF(((PyObject *)__pyx_v_self));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_v_f);
__Pyx_GIVEREF(__pyx_v_f);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156
+ /* "cdec/sa/data_array.pxi":156
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -11261,69 +11819,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __py
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_1);
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL);
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_10 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
- if (__pyx_t_11) {
- __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_12 = ((!(__pyx_t_11 != 0)) != 0);
+ if (__pyx_t_12) {
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_1);
- __Pyx_XGIVEREF(__pyx_t_4);
- __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_4);
- __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_4 = 0;
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_5);
+ __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__18, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__18, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L19;
+ goto __pyx_L18;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L19:;
+ __pyx_L18:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":155
+ /* "cdec/sa/data_array.pxi":155
* f.write("\n")
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -11338,7 +11896,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __py
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -11348,7 +11906,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":10
+/* "cdec/sa/data_array.pxi":10
*
* cdef class DataArray:
* cdef public word2id # <<<<<<<<<<<<<<
@@ -11443,7 +12001,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":11
+/* "cdec/sa/data_array.pxi":11
* cdef class DataArray:
* cdef public word2id
* cdef public id2word # <<<<<<<<<<<<<<
@@ -11538,7 +12096,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":12
+/* "cdec/sa/data_array.pxi":12
* cdef public word2id
* cdef public id2word
* cdef public IntList data # <<<<<<<<<<<<<<
@@ -11646,7 +12204,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":13
+/* "cdec/sa/data_array.pxi":13
* cdef public id2word
* cdef public IntList data
* cdef public IntList sent_id # <<<<<<<<<<<<<<
@@ -11754,7 +12312,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":14
+/* "cdec/sa/data_array.pxi":14
* cdef public IntList data
* cdef public IntList sent_id
* cdef public IntList sent_index # <<<<<<<<<<<<<<
@@ -11867,7 +12425,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("link", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":16
+ /* "cdec/sa/alignment.pxi":16
* cdef int link(self, int i, int j):
* """Integerizes an alignment link pair"""
* return i * ALIGNMENT_CODE + j # <<<<<<<<<<<<<<
@@ -11877,7 +12435,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj
__pyx_r = ((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE) + __pyx_v_j);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":14
+ /* "cdec/sa/alignment.pxi":14
* cdef IntList sent_index
*
* cdef int link(self, int i, int j): # <<<<<<<<<<<<<<
@@ -11891,7 +12449,7 @@ static int __pyx_f_4cdec_2sa_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":18
+/* "cdec/sa/alignment.pxi":18
* return i * ALIGNMENT_CODE + j
*
* def unlink(self, link): # <<<<<<<<<<<<<<
@@ -11924,7 +12482,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("unlink", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":20
+ /* "cdec/sa/alignment.pxi":20
* def unlink(self, link):
* """De-integerizes an alignment link pair"""
* return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) # <<<<<<<<<<<<<<
@@ -11954,7 +12512,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":18
+ /* "cdec/sa/alignment.pxi":18
* return i * ALIGNMENT_CODE + j
*
* def unlink(self, link): # <<<<<<<<<<<<<<
@@ -11975,7 +12533,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":22
+/* "cdec/sa/alignment.pxi":22
* return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE)
*
* cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<<
@@ -11991,7 +12549,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink(CYTHON_UNUSED struct
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_unlink", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":23
+ /* "cdec/sa/alignment.pxi":23
*
* cdef _unlink(self, int link, int* f, int* e):
* f[0] = link / ALIGNMENT_CODE # <<<<<<<<<<<<<<
@@ -12020,7 +12578,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink(CYTHON_UNUSED struct
}
(__pyx_v_f[0]) = __Pyx_div_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":24
+ /* "cdec/sa/alignment.pxi":24
* cdef _unlink(self, int link, int* f, int* e):
* f[0] = link / ALIGNMENT_CODE
* e[0] = link % ALIGNMENT_CODE # <<<<<<<<<<<<<<
@@ -12039,7 +12597,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink(CYTHON_UNUSED struct
}
(__pyx_v_e[0]) = __Pyx_mod_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":22
+ /* "cdec/sa/alignment.pxi":22
* return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE)
*
* cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<<
@@ -12059,7 +12617,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink(CYTHON_UNUSED struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":26
+/* "cdec/sa/alignment.pxi":26
* e[0] = link % ALIGNMENT_CODE
*
* def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<<
@@ -12105,7 +12663,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_sent_links", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":30
+ /* "cdec/sa/alignment.pxi":30
* cdef int* arr
* cdef int arr_len
* sent_links = IntList() # <<<<<<<<<<<<<<
@@ -12117,7 +12675,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
__pyx_v_sent_links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":31
+ /* "cdec/sa/alignment.pxi":31
* cdef int arr_len
* sent_links = IntList()
* arr = self._get_sent_links(sent_id, &arr_len) # <<<<<<<<<<<<<<
@@ -12126,7 +12684,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
*/
__pyx_v_arr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_get_sent_links(__pyx_v_self, __pyx_v_sent_id, (&__pyx_v_arr_len));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":32
+ /* "cdec/sa/alignment.pxi":32
* sent_links = IntList()
* arr = self._get_sent_links(sent_id, &arr_len)
* sent_links._extend_arr(arr, arr_len*2) # <<<<<<<<<<<<<<
@@ -12135,7 +12693,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sent_links->__pyx_vtab)->_extend_arr(__pyx_v_sent_links, __pyx_v_arr, (__pyx_v_arr_len * 2));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":33
+ /* "cdec/sa/alignment.pxi":33
* arr = self._get_sent_links(sent_id, &arr_len)
* sent_links._extend_arr(arr, arr_len*2)
* free(arr) # <<<<<<<<<<<<<<
@@ -12144,7 +12702,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
*/
free(__pyx_v_arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":34
+ /* "cdec/sa/alignment.pxi":34
* sent_links._extend_arr(arr, arr_len*2)
* free(arr)
* return sent_links # <<<<<<<<<<<<<<
@@ -12156,7 +12714,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
__pyx_r = ((PyObject *)__pyx_v_sent_links);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":26
+ /* "cdec/sa/alignment.pxi":26
* e[0] = link % ALIGNMENT_CODE
*
* def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<<
@@ -12176,7 +12734,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":36
+/* "cdec/sa/alignment.pxi":36
* return sent_links
*
* cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<<
@@ -12198,7 +12756,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_get_sent_links", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":39
+ /* "cdec/sa/alignment.pxi":39
* cdef int* sent_links
* cdef int i, start, end
* start = self.sent_index.arr[sent_id] # <<<<<<<<<<<<<<
@@ -12207,7 +12765,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
*/
__pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_v_sent_id]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":40
+ /* "cdec/sa/alignment.pxi":40
* cdef int i, start, end
* start = self.sent_index.arr[sent_id]
* end = self.sent_index.arr[sent_id+1] # <<<<<<<<<<<<<<
@@ -12216,7 +12774,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
*/
__pyx_v_end = (__pyx_v_self->sent_index->arr[(__pyx_v_sent_id + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":41
+ /* "cdec/sa/alignment.pxi":41
* start = self.sent_index.arr[sent_id]
* end = self.sent_index.arr[sent_id+1]
* num_links[0] = end - start # <<<<<<<<<<<<<<
@@ -12225,7 +12783,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
*/
(__pyx_v_num_links[0]) = (__pyx_v_end - __pyx_v_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":42
+ /* "cdec/sa/alignment.pxi":42
* end = self.sent_index.arr[sent_id+1]
* num_links[0] = end - start
* sent_links = <int*> malloc(2*num_links[0]*sizeof(int)) # <<<<<<<<<<<<<<
@@ -12234,7 +12792,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
*/
__pyx_v_sent_links = ((int *)malloc(((2 * (__pyx_v_num_links[0])) * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":43
+ /* "cdec/sa/alignment.pxi":43
* num_links[0] = end - start
* sent_links = <int*> malloc(2*num_links[0]*sizeof(int))
* for i from 0 <= i < num_links[0]: # <<<<<<<<<<<<<<
@@ -12244,7 +12802,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
__pyx_t_1 = (__pyx_v_num_links[0]);
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":44
+ /* "cdec/sa/alignment.pxi":44
* sent_links = <int*> malloc(2*num_links[0]*sizeof(int))
* for i from 0 <= i < num_links[0]:
* self._unlink(self.links.arr[start + i], sent_links + (2*i), sent_links + (2*i) + 1) # <<<<<<<<<<<<<<
@@ -12256,7 +12814,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":45
+ /* "cdec/sa/alignment.pxi":45
* for i from 0 <= i < num_links[0]:
* self._unlink(self.links.arr[start + i], sent_links + (2*i), sent_links + (2*i) + 1)
* return sent_links # <<<<<<<<<<<<<<
@@ -12266,7 +12824,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
__pyx_r = __pyx_v_sent_links;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":36
+ /* "cdec/sa/alignment.pxi":36
* return sent_links
*
* cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<<
@@ -12284,7 +12842,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":47
+/* "cdec/sa/alignment.pxi":47
* return sent_links
*
* def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<<
@@ -12366,12 +12924,13 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48
+ /* "cdec/sa/alignment.pxi":48
*
* def __cinit__(self, from_binary=None, from_text=None):
* self.links = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -12386,7 +12945,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
__pyx_v_self->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":49
+ /* "cdec/sa/alignment.pxi":49
* def __cinit__(self, from_binary=None, from_text=None):
* self.links = IntList(1000,1000)
* self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -12401,7 +12960,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
__pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":50
+ /* "cdec/sa/alignment.pxi":50
* self.links = IntList(1000,1000)
* self.sent_index = IntList(1000,1000)
* if from_binary: # <<<<<<<<<<<<<<
@@ -12411,29 +12970,45 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":51
+ /* "cdec/sa/alignment.pxi":51
* self.sent_index = IntList(1000,1000)
* if from_binary:
* self.read_binary(from_binary) # <<<<<<<<<<<<<<
* elif from_text:
* self.read_text(from_text)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_binary);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary);
- __Pyx_GIVEREF(__pyx_v_from_binary);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_from_binary);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_from_binary);
+ __Pyx_GIVEREF(__pyx_v_from_binary);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":52
+ /* "cdec/sa/alignment.pxi":52
* if from_binary:
* self.read_binary(from_binary)
* elif from_text: # <<<<<<<<<<<<<<
@@ -12443,30 +13018,46 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":53
+ /* "cdec/sa/alignment.pxi":53
* self.read_binary(from_binary)
* elif from_text:
* self.read_text(from_text) # <<<<<<<<<<<<<<
*
* def read_text(self, char* filename):
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_text);
- __Pyx_GIVEREF(__pyx_v_from_text);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_from_text);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_from_text);
+ __Pyx_GIVEREF(__pyx_v_from_text);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":47
+ /* "cdec/sa/alignment.pxi":47
* return sent_links
*
* def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<<
@@ -12481,6 +13072,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -12488,7 +13080,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":55
+/* "cdec/sa/alignment.pxi":55
* self.read_text(from_text)
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -12538,13 +13130,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
Py_ssize_t __pyx_t_10;
- int __pyx_t_11;
- PyObject *(*__pyx_t_12)(PyObject *);
- PyObject *__pyx_t_13 = NULL;
- PyObject *__pyx_t_14 = NULL;
+ PyObject *(*__pyx_t_11)(PyObject *);
+ Py_ssize_t __pyx_t_12;
+ int __pyx_t_13;
+ PyObject *(*__pyx_t_14)(PyObject *);
PyObject *__pyx_t_15 = NULL;
PyObject *(*__pyx_t_16)(PyObject *);
int __pyx_t_17;
@@ -12557,7 +13149,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56
+ /* "cdec/sa/alignment.pxi":56
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
@@ -12565,71 +13157,106 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
* self.sent_index.append(len(self.links))
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
- __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_v_f = __pyx_t_1;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_f = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":57
+ /* "cdec/sa/alignment.pxi":57
* def read_text(self, char* filename):
* with gzip_or_text(filename) as f:
* for line in f: # <<<<<<<<<<<<<<
* self.sent_index.append(len(self.links))
* pairs = line.split()
*/
- if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) {
- __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_f)) || PyTuple_CheckExact(__pyx_v_f)) {
+ __pyx_t_5 = __pyx_v_f; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
+ __pyx_t_11 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_11)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_1 = __pyx_t_11(__pyx_t_5);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -12637,28 +13264,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
- __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":58
+ /* "cdec/sa/alignment.pxi":58
* with gzip_or_text(filename) as f:
* for line in f:
* self.sent_index.append(len(self.links)) # <<<<<<<<<<<<<<
* pairs = line.split()
* for pair in pairs:
*/
- __pyx_t_2 = ((PyObject *)__pyx_v_self->links);
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_2); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->links);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_12 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":59
+ /* "cdec/sa/alignment.pxi":59
* for line in f:
* self.sent_index.append(len(self.links))
* pairs = line.split() # <<<<<<<<<<<<<<
@@ -12667,44 +13294,61 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF_SET(__pyx_v_pairs, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pairs, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":60
+ /* "cdec/sa/alignment.pxi":60
* self.sent_index.append(len(self.links))
* pairs = line.split()
* for pair in pairs: # <<<<<<<<<<<<<<
* (i, j) = map(int, pair.split('-'))
* self.links.append(self.link(i, j))
*/
- if (PyList_CheckExact(__pyx_v_pairs) || PyTuple_CheckExact(__pyx_v_pairs)) {
- __pyx_t_3 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0;
- __pyx_t_12 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_pairs)) || PyTuple_CheckExact(__pyx_v_pairs)) {
+ __pyx_t_1 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
+ __pyx_t_14 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_14)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_12(__pyx_t_3);
+ __pyx_t_2 = __pyx_t_14(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -12718,7 +13362,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
__Pyx_XDECREF_SET(__pyx_v_pair, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61
+ /* "cdec/sa/alignment.pxi":61
* pairs = line.split()
* for pair in pairs:
* (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<<
@@ -12727,22 +13371,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
*/
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
__Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_13);
- __Pyx_GIVEREF(__pyx_t_13);
- __pyx_t_13 = 0;
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_13);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
- PyObject* sequence = __pyx_t_13;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -12756,47 +13400,47 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_2 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
#endif
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_15 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
- index = 0; __pyx_t_2 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed;
+ index = 0; __pyx_t_2 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_2)) goto __pyx_L19_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
- index = 1; __pyx_t_14 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L20_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_14);
+ index = 1; __pyx_t_4 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L19_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_16 = NULL;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- goto __pyx_L21_unpacking_done;
- __pyx_L20_unpacking_failed:;
+ goto __pyx_L20_unpacking_done;
+ __pyx_L19_unpacking_failed:;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_16 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L21_unpacking_done:;
+ __pyx_L20_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
- __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_14);
- __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":62
+ /* "cdec/sa/alignment.pxi":62
* for pair in pairs:
* (i, j) = map(int, pair.split('-'))
* self.links.append(self.link(i, j)) # <<<<<<<<<<<<<<
@@ -12805,44 +13449,60 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
*/
__pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_j); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_13 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_17, __pyx_t_18)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_11 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_13); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_17, __pyx_t_18)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_3); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "cdec/sa/alignment.pxi":60
+ * self.sent_index.append(len(self.links))
+ * pairs = line.split()
+ * for pair in pairs: # <<<<<<<<<<<<<<
+ * (i, j) = map(int, pair.split('-'))
+ * self.links.append(self.link(i, j))
+ */
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "cdec/sa/alignment.pxi":57
+ * def read_text(self, char* filename):
+ * with gzip_or_text(filename) as f:
+ * for line in f: # <<<<<<<<<<<<<<
+ * self.sent_index.append(len(self.links))
+ * pairs = line.split()
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":63
+ /* "cdec/sa/alignment.pxi":63
* (i, j) = map(int, pair.split('-'))
* self.links.append(self.link(i, j))
* self.sent_index.append(len(self.links)) # <<<<<<<<<<<<<<
*
* def read_binary(self, char* filename):
*/
- __pyx_t_1 = ((PyObject *)__pyx_v_self->links);
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_5 = ((PyObject *)__pyx_v_self->links);
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_10 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_5); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56
+ /* "cdec/sa/alignment.pxi":56
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
@@ -12851,15 +13511,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL);
+ __pyx_t_4 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_19);
__pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_19);
@@ -12867,53 +13527,53 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
if (__pyx_t_20 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__pyx_t_21 = ((!(__pyx_t_20 != 0)) != 0);
if (__pyx_t_21) {
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_XGIVEREF(__pyx_t_13);
- __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_13);
- __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_13 = 0;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_ErrRestore(__pyx_t_5, __pyx_t_1, __pyx_t_3);
+ __pyx_t_5 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
- if (__pyx_t_4) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__23, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_6) {
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__23, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L25;
+ goto __pyx_L24;
__pyx_L3_error:;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L1_error;
- __pyx_L25:;
+ __pyx_L24:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":55
+ /* "cdec/sa/alignment.pxi":55
* self.read_text(from_text)
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -12928,8 +13588,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_13);
- __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_15);
__Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
@@ -12945,7 +13605,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":65
+/* "cdec/sa/alignment.pxi":65
* self.sent_index.append(len(self.links))
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -12985,7 +13645,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":67
+ /* "cdec/sa/alignment.pxi":67
* def read_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -12994,7 +13654,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":68
+ /* "cdec/sa/alignment.pxi":68
* cdef FILE* f
* f = fopen(filename, "r")
* self.links.read_handle(f) # <<<<<<<<<<<<<<
@@ -13003,7 +13663,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":69
+ /* "cdec/sa/alignment.pxi":69
* f = fopen(filename, "r")
* self.links.read_handle(f)
* self.sent_index.read_handle(f) # <<<<<<<<<<<<<<
@@ -13012,7 +13672,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":70
+ /* "cdec/sa/alignment.pxi":70
* self.links.read_handle(f)
* self.sent_index.read_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -13021,7 +13681,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":65
+ /* "cdec/sa/alignment.pxi":65
* self.sent_index.append(len(self.links))
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -13036,7 +13696,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":72
+/* "cdec/sa/alignment.pxi":72
* fclose(f)
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -13084,20 +13744,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
int __pyx_t_11;
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
PyObject *__pyx_t_14 = NULL;
- int __pyx_t_15;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
+ int __pyx_t_17;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73
+ /* "cdec/sa/alignment.pxi":73
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -13120,24 +13782,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":74
+ /* "cdec/sa/alignment.pxi":74
* def write_text(self, char* filename):
* with open(filename, "w") as f:
* sent_num = 0 # <<<<<<<<<<<<<<
@@ -13147,7 +13825,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__Pyx_INCREF(__pyx_int_0);
__pyx_v_sent_num = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":75
+ /* "cdec/sa/alignment.pxi":75
* with open(filename, "w") as f:
* sent_num = 0
* for i, link in enumerate(self.links): # <<<<<<<<<<<<<<
@@ -13156,31 +13834,33 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_4 = __pyx_int_0;
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->links)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) {
- __pyx_t_1 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->links))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) {
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_1);
+ __pyx_t_2 = __pyx_t_10(__pyx_t_1);
if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -13201,7 +13881,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__pyx_t_4 = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":76
+ /* "cdec/sa/alignment.pxi":76
* sent_num = 0
* for i, link in enumerate(self.links):
* while i >= self.sent_index[sent_num]: # <<<<<<<<<<<<<<
@@ -13211,27 +13891,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
while (1) {
__pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->sent_index), __pyx_v_sent_num); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!__pyx_t_11) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":77
+ /* "cdec/sa/alignment.pxi":77
* for i, link in enumerate(self.links):
* while i >= self.sent_index[sent_num]:
* f.write("\n") # <<<<<<<<<<<<<<
* sent_num = sent_num + 1
* f.write("%d-%d " % self.unlink(link))
*/
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":78
+ /* "cdec/sa/alignment.pxi":78
* while i >= self.sent_index[sent_num]:
* f.write("\n")
* sent_num = sent_num + 1 # <<<<<<<<<<<<<<
@@ -13244,44 +13924,85 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":79
+ /* "cdec/sa/alignment.pxi":79
* f.write("\n")
* sent_num = sent_num + 1
* f.write("%d-%d " % self.unlink(link)) # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_INCREF(__pyx_v_link);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_link);
- __Pyx_GIVEREF(__pyx_v_link);
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d_d, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_14 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_13, function);
+ }
+ }
+ if (!__pyx_t_14) {
+ __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_link); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ } else {
+ __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
+ __Pyx_INCREF(__pyx_v_link);
+ PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_link);
+ __Pyx_GIVEREF(__pyx_v_link);
+ __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ }
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_13 = __Pyx_PyString_Format(__pyx_kp_s_d_d, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_13);
- PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
- __Pyx_GIVEREF(__pyx_t_12);
- __pyx_t_12 = 0;
- __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_12) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_GOTREF(__pyx_t_2);
+ } else {
+ __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_13);
+ __pyx_t_13 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "cdec/sa/alignment.pxi":75
+ * with open(filename, "w") as f:
+ * sent_num = 0
+ * for i, link in enumerate(self.links): # <<<<<<<<<<<<<<
+ * while i >= self.sent_index[sent_num]:
+ * f.write("\n")
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80
+ /* "cdec/sa/alignment.pxi":80
* sent_num = sent_num + 1
* f.write("%d-%d " % self.unlink(link))
* f.write("\n") # <<<<<<<<<<<<<<
@@ -13295,19 +14016,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73
+ /* "cdec/sa/alignment.pxi":73
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -13316,69 +14039,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_12) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_GOTREF(__pyx_t_12);
- __pyx_t_13 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL);
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_15 = ((!(__pyx_t_11 != 0)) != 0);
- if (__pyx_t_15) {
+ __pyx_t_17 = ((!(__pyx_t_11 != 0)) != 0);
+ if (__pyx_t_17) {
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_XGIVEREF(__pyx_t_12);
- __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_12);
- __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_12 = 0;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_2);
+ __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__26, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__26, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L23;
+ goto __pyx_L22;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":72
+ /* "cdec/sa/alignment.pxi":72
* fclose(f)
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -13393,9 +14116,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_13);
+ __Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
__Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -13408,7 +14133,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":82
+/* "cdec/sa/alignment.pxi":82
* f.write("\n")
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -13448,7 +14173,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":84
+ /* "cdec/sa/alignment.pxi":84
* def write_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -13457,7 +14182,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":85
+ /* "cdec/sa/alignment.pxi":85
* cdef FILE* f
* f = fopen(filename, "w")
* self.links.write_handle(f) # <<<<<<<<<<<<<<
@@ -13466,7 +14191,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":86
+ /* "cdec/sa/alignment.pxi":86
* f = fopen(filename, "w")
* self.links.write_handle(f)
* self.sent_index.write_handle(f) # <<<<<<<<<<<<<<
@@ -13475,7 +14200,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":87
+ /* "cdec/sa/alignment.pxi":87
* self.links.write_handle(f)
* self.sent_index.write_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -13484,7 +14209,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":82
+ /* "cdec/sa/alignment.pxi":82
* f.write("\n")
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -13499,7 +14224,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":89
+/* "cdec/sa/alignment.pxi":89
* fclose(f)
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -13546,18 +14271,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
- int __pyx_t_12;
- int __pyx_t_13;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ int __pyx_t_14;
+ int __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_enhanced", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90
+ /* "cdec/sa/alignment.pxi":90
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -13580,55 +14307,73 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":91
+ /* "cdec/sa/alignment.pxi":91
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f:
* for link in self.links: # <<<<<<<<<<<<<<
* f.write("%d " % link)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->links)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) {
- __pyx_t_4 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->links))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->links))) {
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->links)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_9(__pyx_t_4);
+ __pyx_t_1 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -13642,31 +14387,56 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
__Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":92
+ /* "cdec/sa/alignment.pxi":92
* with open(filename, "w") as f:
* for link in self.links:
* f.write("%d " % link) # <<<<<<<<<<<<<<
* f.write("\n")
* for i in self.sent_index:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_link); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "cdec/sa/alignment.pxi":91
+ * def write_enhanced(self, char* filename):
+ * with open(filename, "w") as f:
+ * for link in self.links: # <<<<<<<<<<<<<<
+ * f.write("%d " % link)
+ * f.write("\n")
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93
+ /* "cdec/sa/alignment.pxi":93
* for link in self.links:
* f.write("%d " % link)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -13675,43 +14445,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
*/
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":94
+ /* "cdec/sa/alignment.pxi":94
* f.write("%d " % link)
* f.write("\n")
* for i in self.sent_index: # <<<<<<<<<<<<<<
* f.write("%d " % i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) {
- __pyx_t_2 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->sent_index))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sent_index))) {
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->sent_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_9(__pyx_t_2);
+ __pyx_t_4 = __pyx_t_10(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -13725,55 +14497,82 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":95
+ /* "cdec/sa/alignment.pxi":95
* f.write("\n")
* for i in self.sent_index:
* f.write("%d " % i) # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+
+ /* "cdec/sa/alignment.pxi":94
+ * f.write("%d " % link)
+ * f.write("\n")
+ * for i in self.sent_index: # <<<<<<<<<<<<<<
+ * f.write("%d " % i)
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":96
+ /* "cdec/sa/alignment.pxi":96
* for i in self.sent_index:
* f.write("%d " % i)
* f.write("\n") # <<<<<<<<<<<<<<
*
* def alignment(self, i):
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90
+ /* "cdec/sa/alignment.pxi":90
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -13782,69 +14581,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_Pack(3, __pyx_t_10, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
+ __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_12 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0);
- if (__pyx_t_13) {
- __Pyx_GIVEREF(__pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_XGIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_10, __pyx_t_2, __pyx_t_1);
- __pyx_t_10 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0;
+ if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
+ if (__pyx_t_15) {
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_2);
+ __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__29, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__29, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L23;
+ goto __pyx_L22;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":89
+ /* "cdec/sa/alignment.pxi":89
* fclose(f)
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -13859,7 +14658,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -13871,7 +14672,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":98
+/* "cdec/sa/alignment.pxi":98
* f.write("\n")
*
* def alignment(self, i): # <<<<<<<<<<<<<<
@@ -13905,13 +14706,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- int __pyx_t_6;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("alignment", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":101
+ /* "cdec/sa/alignment.pxi":101
* """Return all (e,f) pairs for sentence i"""
* cdef int j, start, end
* result = [] # <<<<<<<<<<<<<<
@@ -13923,7 +14726,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__pyx_v_result = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":102
+ /* "cdec/sa/alignment.pxi":102
* cdef int j, start, end
* result = []
* start = self.sent_index.arr[i] # <<<<<<<<<<<<<<
@@ -13933,7 +14736,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_t_2]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":103
+ /* "cdec/sa/alignment.pxi":103
* result = []
* start = self.sent_index.arr[i]
* end = self.sent_index.arr[i+1] # <<<<<<<<<<<<<<
@@ -13946,7 +14749,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_end = (__pyx_v_self->sent_index->arr[__pyx_t_2]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":104
+ /* "cdec/sa/alignment.pxi":104
* start = self.sent_index.arr[i]
* end = self.sent_index.arr[i+1]
* for j from start <= j < end: # <<<<<<<<<<<<<<
@@ -13956,30 +14759,47 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__pyx_t_3 = __pyx_v_end;
for (__pyx_v_j = __pyx_v_start; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":105
+ /* "cdec/sa/alignment.pxi":105
* end = self.sent_index.arr[i+1]
* for j from start <= j < end:
* result.append(self.unlink(self.links.arr[j])) # <<<<<<<<<<<<<<
* return result
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->links->arr[__pyx_v_j])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_self->links->arr[__pyx_v_j])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":106
+ /* "cdec/sa/alignment.pxi":106
* for j from start <= j < end:
* result.append(self.unlink(self.links.arr[j]))
* return result # <<<<<<<<<<<<<<
@@ -13989,7 +14809,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":98
+ /* "cdec/sa/alignment.pxi":98
* f.write("\n")
*
* def alignment(self, i): # <<<<<<<<<<<<<<
@@ -14002,6 +14822,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -14011,7 +14833,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":15
+/* "cdec/sa/bilex.pxi":15
* int val
*
* cdef _node* new_node(int key): # <<<<<<<<<<<<<<
@@ -14025,7 +14847,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("new_node", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":17
+ /* "cdec/sa/bilex.pxi":17
* cdef _node* new_node(int key):
* cdef _node* n
* n = <_node*> malloc(sizeof(_node)) # <<<<<<<<<<<<<<
@@ -14034,7 +14856,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
*/
__pyx_v_n = ((struct __pyx_t_4cdec_2sa_3_sa__node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__node))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":18
+ /* "cdec/sa/bilex.pxi":18
* cdef _node* n
* n = <_node*> malloc(sizeof(_node))
* n.smaller = NULL # <<<<<<<<<<<<<<
@@ -14043,7 +14865,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
*/
__pyx_v_n->smaller = NULL;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":19
+ /* "cdec/sa/bilex.pxi":19
* n = <_node*> malloc(sizeof(_node))
* n.smaller = NULL
* n.bigger = NULL # <<<<<<<<<<<<<<
@@ -14052,7 +14874,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
*/
__pyx_v_n->bigger = NULL;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":20
+ /* "cdec/sa/bilex.pxi":20
* n.smaller = NULL
* n.bigger = NULL
* n.key = key # <<<<<<<<<<<<<<
@@ -14061,7 +14883,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
*/
__pyx_v_n->key = __pyx_v_key;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":21
+ /* "cdec/sa/bilex.pxi":21
* n.bigger = NULL
* n.key = key
* n.val = 0 # <<<<<<<<<<<<<<
@@ -14070,7 +14892,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
*/
__pyx_v_n->val = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":22
+ /* "cdec/sa/bilex.pxi":22
* n.key = key
* n.val = 0
* return n # <<<<<<<<<<<<<<
@@ -14080,7 +14902,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
__pyx_r = __pyx_v_n;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":15
+ /* "cdec/sa/bilex.pxi":15
* int val
*
* cdef _node* new_node(int key): # <<<<<<<<<<<<<<
@@ -14094,7 +14916,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":25
+/* "cdec/sa/bilex.pxi":25
*
*
* cdef del_node(_node* n): # <<<<<<<<<<<<<<
@@ -14112,7 +14934,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("del_node", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":26
+ /* "cdec/sa/bilex.pxi":26
*
* cdef del_node(_node* n):
* if n.smaller != NULL: # <<<<<<<<<<<<<<
@@ -14122,7 +14944,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
__pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":27
+ /* "cdec/sa/bilex.pxi":27
* cdef del_node(_node* n):
* if n.smaller != NULL:
* del_node(n.smaller) # <<<<<<<<<<<<<<
@@ -14136,7 +14958,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":28
+ /* "cdec/sa/bilex.pxi":28
* if n.smaller != NULL:
* del_node(n.smaller)
* if n.bigger != NULL: # <<<<<<<<<<<<<<
@@ -14146,7 +14968,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
__pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":29
+ /* "cdec/sa/bilex.pxi":29
* del_node(n.smaller)
* if n.bigger != NULL:
* del_node(n.bigger) # <<<<<<<<<<<<<<
@@ -14160,7 +14982,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":30
+ /* "cdec/sa/bilex.pxi":30
* if n.bigger != NULL:
* del_node(n.bigger)
* free(n) # <<<<<<<<<<<<<<
@@ -14169,7 +14991,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
*/
free(__pyx_v_n);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":25
+ /* "cdec/sa/bilex.pxi":25
*
*
* cdef del_node(_node* n): # <<<<<<<<<<<<<<
@@ -14190,7 +15012,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":32
+/* "cdec/sa/bilex.pxi":32
* free(n)
*
* cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<<
@@ -14204,7 +15026,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
int __pyx_t_1;
__Pyx_RefNannySetupContext("get_val", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":33
+ /* "cdec/sa/bilex.pxi":33
*
* cdef int* get_val(_node* n, int key):
* if key == n.key: # <<<<<<<<<<<<<<
@@ -14214,7 +15036,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
__pyx_t_1 = ((__pyx_v_key == __pyx_v_n->key) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":34
+ /* "cdec/sa/bilex.pxi":34
* cdef int* get_val(_node* n, int key):
* if key == n.key:
* return &n.val # <<<<<<<<<<<<<<
@@ -14225,7 +15047,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":35
+ /* "cdec/sa/bilex.pxi":35
* if key == n.key:
* return &n.val
* elif key < n.key: # <<<<<<<<<<<<<<
@@ -14235,7 +15057,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
__pyx_t_1 = ((__pyx_v_key < __pyx_v_n->key) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":36
+ /* "cdec/sa/bilex.pxi":36
* return &n.val
* elif key < n.key:
* if n.smaller == NULL: # <<<<<<<<<<<<<<
@@ -14245,7 +15067,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
__pyx_t_1 = ((__pyx_v_n->smaller == NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":37
+ /* "cdec/sa/bilex.pxi":37
* elif key < n.key:
* if n.smaller == NULL:
* n.smaller = new_node(key) # <<<<<<<<<<<<<<
@@ -14254,7 +15076,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
*/
__pyx_v_n->smaller = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":38
+ /* "cdec/sa/bilex.pxi":38
* if n.smaller == NULL:
* n.smaller = new_node(key)
* return &(n.smaller.val) # <<<<<<<<<<<<<<
@@ -14265,7 +15087,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":39
+ /* "cdec/sa/bilex.pxi":39
* n.smaller = new_node(key)
* return &(n.smaller.val)
* return get_val(n.smaller, key) # <<<<<<<<<<<<<<
@@ -14277,7 +15099,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":41
+ /* "cdec/sa/bilex.pxi":41
* return get_val(n.smaller, key)
* else:
* if n.bigger == NULL: # <<<<<<<<<<<<<<
@@ -14287,7 +15109,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
__pyx_t_1 = ((__pyx_v_n->bigger == NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":42
+ /* "cdec/sa/bilex.pxi":42
* else:
* if n.bigger == NULL:
* n.bigger = new_node(key) # <<<<<<<<<<<<<<
@@ -14296,7 +15118,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
*/
__pyx_v_n->bigger = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":43
+ /* "cdec/sa/bilex.pxi":43
* if n.bigger == NULL:
* n.bigger = new_node(key)
* return &(n.bigger.val) # <<<<<<<<<<<<<<
@@ -14307,7 +15129,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":44
+ /* "cdec/sa/bilex.pxi":44
* n.bigger = new_node(key)
* return &(n.bigger.val)
* return get_val(n.bigger, key) # <<<<<<<<<<<<<<
@@ -14318,7 +15140,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":32
+ /* "cdec/sa/bilex.pxi":32
* free(n)
*
* cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<<
@@ -14332,7 +15154,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54
+/* "cdec/sa/bilex.pxi":54
* cdef id2eword, id2fword, eword2id, fword2id
*
* def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<<
@@ -14362,7 +15184,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyO
values[1] = ((PyObject *)Py_False);
values[2] = ((PyObject *)Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":55
+ /* "cdec/sa/bilex.pxi":55
*
* def __cinit__(self, from_text=None, from_data=False, from_binary=None,
* earray=None, fsarray=None, alignment=None): # <<<<<<<<<<<<<<
@@ -14450,7 +15272,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyO
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_from_text, __pyx_v_from_data, __pyx_v_from_binary, __pyx_v_earray, __pyx_v_fsarray, __pyx_v_alignment);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54
+ /* "cdec/sa/bilex.pxi":54
* cdef id2eword, id2fword, eword2id, fword2id
*
* def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<<
@@ -14470,12 +15292,13 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":56
+ /* "cdec/sa/bilex.pxi":56
* def __cinit__(self, from_text=None, from_data=False, from_binary=None,
* earray=None, fsarray=None, alignment=None):
* self.id2eword = [] # <<<<<<<<<<<<<<
@@ -14490,7 +15313,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->id2eword = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":57
+ /* "cdec/sa/bilex.pxi":57
* earray=None, fsarray=None, alignment=None):
* self.id2eword = []
* self.id2fword = [] # <<<<<<<<<<<<<<
@@ -14505,7 +15328,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->id2fword = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":58
+ /* "cdec/sa/bilex.pxi":58
* self.id2eword = []
* self.id2fword = []
* self.eword2id = {} # <<<<<<<<<<<<<<
@@ -14520,7 +15343,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->eword2id = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":59
+ /* "cdec/sa/bilex.pxi":59
* self.id2fword = []
* self.eword2id = {}
* self.fword2id = {} # <<<<<<<<<<<<<<
@@ -14535,7 +15358,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->fword2id = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":60
+ /* "cdec/sa/bilex.pxi":60
* self.eword2id = {}
* self.fword2id = {}
* self.e_index = IntList() # <<<<<<<<<<<<<<
@@ -14550,7 +15373,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":61
+ /* "cdec/sa/bilex.pxi":61
* self.fword2id = {}
* self.e_index = IntList()
* self.f_index = IntList() # <<<<<<<<<<<<<<
@@ -14565,7 +15388,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":62
+ /* "cdec/sa/bilex.pxi":62
* self.e_index = IntList()
* self.f_index = IntList()
* self.col1 = FloatList() # <<<<<<<<<<<<<<
@@ -14580,7 +15403,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":63
+ /* "cdec/sa/bilex.pxi":63
* self.f_index = IntList()
* self.col1 = FloatList()
* self.col2 = FloatList() # <<<<<<<<<<<<<<
@@ -14595,7 +15418,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":64
+ /* "cdec/sa/bilex.pxi":64
* self.col1 = FloatList()
* self.col2 = FloatList()
* if from_binary: # <<<<<<<<<<<<<<
@@ -14605,29 +15428,45 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":65
+ /* "cdec/sa/bilex.pxi":65
* self.col2 = FloatList()
* if from_binary:
* self.read_binary(from_binary) # <<<<<<<<<<<<<<
* elif from_data:
* self.compute_from_data(fsarray, earray, alignment)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_binary);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary);
- __Pyx_GIVEREF(__pyx_v_from_binary);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_from_binary);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_from_binary);
+ __Pyx_GIVEREF(__pyx_v_from_binary);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":66
+ /* "cdec/sa/bilex.pxi":66
* if from_binary:
* self.read_binary(from_binary)
* elif from_data: # <<<<<<<<<<<<<<
@@ -14637,7 +15476,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_data); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":67
+ /* "cdec/sa/bilex.pxi":67
* self.read_binary(from_binary)
* elif from_data:
* self.compute_from_data(fsarray, earray, alignment) # <<<<<<<<<<<<<<
@@ -14647,36 +15486,52 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
if (!(likely(((__pyx_v_fsarray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fsarray, __pyx_ptype_4cdec_2sa_3_sa_SuffixArray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!(likely(((__pyx_v_earray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_earray, __pyx_ptype_4cdec_2sa_3_sa_DataArray))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!(likely(((__pyx_v_alignment) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_alignment, __pyx_ptype_4cdec_2sa_3_sa_Alignment))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_fsarray), ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_earray), ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_alignment)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_fsarray), ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_earray), ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_alignment)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":69
+ /* "cdec/sa/bilex.pxi":69
* self.compute_from_data(fsarray, earray, alignment)
* else:
* self.read_text(from_text) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_text);
- __Pyx_GIVEREF(__pyx_v_from_text);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_from_text);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_from_text);
+ __Pyx_GIVEREF(__pyx_v_from_text);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54
+ /* "cdec/sa/bilex.pxi":54
* cdef id2eword, id2fword, eword2id, fword2id
*
* def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<<
@@ -14691,6 +15546,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -14698,12 +15554,12 @@ static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":72
+/* "cdec/sa/bilex.pxi":72
*
*
* cdef compute_from_data(self, SuffixArray fsa, DataArray eda, Alignment aa): # <<<<<<<<<<<<<<
* cdef int sent_id, num_links, l, i, j, f_i, e_j, I, J, V_E, V_F, num_pairs
- * cdef int *fsent, *esent, *alignment, *links, *ealigned, *faligned
+ * cdef int *fsent
*/
static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsa, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_eda, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_aa) {
@@ -14744,16 +15600,15 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
int __pyx_t_8;
int __pyx_t_9;
int __pyx_t_10;
- int __pyx_t_11;
+ PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
- PyObject *__pyx_t_14 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("compute_from_data", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":79
+ /* "cdec/sa/bilex.pxi":86
* cdef int null_word
*
* null_word = 0 # <<<<<<<<<<<<<<
@@ -14762,43 +15617,45 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_null_word = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":80
+ /* "cdec/sa/bilex.pxi":87
*
* null_word = 0
* for word in fsa.darray.id2word: # I miss list comprehensions # <<<<<<<<<<<<<<
* self.id2fword.append(word)
* self.id2fword[null_word] = "NULL"
*/
- if (PyList_CheckExact(__pyx_v_fsa->darray->id2word) || PyTuple_CheckExact(__pyx_v_fsa->darray->id2word)) {
+ if (likely(PyList_CheckExact(__pyx_v_fsa->darray->id2word)) || PyTuple_CheckExact(__pyx_v_fsa->darray->id2word)) {
__pyx_t_1 = __pyx_v_fsa->darray->id2word; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_fsa->darray->id2word); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_fsa->darray->id2word); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -14807,27 +15664,35 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":81
+ /* "cdec/sa/bilex.pxi":88
* null_word = 0
* for word in fsa.darray.id2word: # I miss list comprehensions
* self.id2fword.append(word) # <<<<<<<<<<<<<<
* self.id2fword[null_word] = "NULL"
* for id, word in enumerate(self.id2fword):
*/
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/bilex.pxi":87
+ *
+ * null_word = 0
+ * for word in fsa.darray.id2word: # I miss list comprehensions # <<<<<<<<<<<<<<
+ * self.id2fword.append(word)
+ * self.id2fword[null_word] = "NULL"
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":82
+ /* "cdec/sa/bilex.pxi":89
* for word in fsa.darray.id2word: # I miss list comprehensions
* self.id2fword.append(word)
* self.id2fword[null_word] = "NULL" # <<<<<<<<<<<<<<
* for id, word in enumerate(self.id2fword):
* self.fword2id[word] = id
*/
- if (unlikely(__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, __pyx_n_s_NULL, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, __pyx_n_s_NULL, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":83
+ /* "cdec/sa/bilex.pxi":90
* self.id2fword.append(word)
* self.id2fword[null_word] = "NULL"
* for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<<
@@ -14836,36 +15701,38 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_self->id2fword) || PyTuple_CheckExact(__pyx_v_self->id2fword)) {
+ if (likely(PyList_CheckExact(__pyx_v_self->id2fword)) || PyTuple_CheckExact(__pyx_v_self->id2fword)) {
__pyx_t_4 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_3(__pyx_t_4);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -14875,61 +15742,71 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_id, __pyx_t_1);
- __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":84
+ /* "cdec/sa/bilex.pxi":91
* self.id2fword[null_word] = "NULL"
* for id, word in enumerate(self.id2fword):
* self.fword2id[word] = id # <<<<<<<<<<<<<<
*
* for word in eda.id2word:
*/
- if (unlikely(PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_word, __pyx_v_id) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_word, __pyx_v_id) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/bilex.pxi":90
+ * self.id2fword.append(word)
+ * self.id2fword[null_word] = "NULL"
+ * for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<<
+ * self.fword2id[word] = id
+ *
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":86
+ /* "cdec/sa/bilex.pxi":93
* self.fword2id[word] = id
*
* for word in eda.id2word: # <<<<<<<<<<<<<<
* self.id2eword.append(word)
* self.id2eword[null_word] = "NULL"
*/
- if (PyList_CheckExact(__pyx_v_eda->id2word) || PyTuple_CheckExact(__pyx_v_eda->id2word)) {
+ if (likely(PyList_CheckExact(__pyx_v_eda->id2word)) || PyTuple_CheckExact(__pyx_v_eda->id2word)) {
__pyx_t_1 = __pyx_v_eda->id2word; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_eda->id2word); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_eda->id2word); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -14938,27 +15815,35 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":87
+ /* "cdec/sa/bilex.pxi":94
*
* for word in eda.id2word:
* self.id2eword.append(word) # <<<<<<<<<<<<<<
* self.id2eword[null_word] = "NULL"
* for id, word in enumerate(self.id2eword):
*/
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/bilex.pxi":93
+ * self.fword2id[word] = id
+ *
+ * for word in eda.id2word: # <<<<<<<<<<<<<<
+ * self.id2eword.append(word)
+ * self.id2eword[null_word] = "NULL"
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":88
+ /* "cdec/sa/bilex.pxi":95
* for word in eda.id2word:
* self.id2eword.append(word)
* self.id2eword[null_word] = "NULL" # <<<<<<<<<<<<<<
* for id, word in enumerate(self.id2eword):
* self.eword2id[word] = id
*/
- if (unlikely(__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, __pyx_n_s_NULL, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, __pyx_n_s_NULL, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":89
+ /* "cdec/sa/bilex.pxi":96
* self.id2eword.append(word)
* self.id2eword[null_word] = "NULL"
* for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<<
@@ -14967,36 +15852,38 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_self->id2eword) || PyTuple_CheckExact(__pyx_v_self->id2eword)) {
+ if (likely(PyList_CheckExact(__pyx_v_self->id2eword)) || PyTuple_CheckExact(__pyx_v_self->id2eword)) {
__pyx_t_4 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_3(__pyx_t_4);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -15006,25 +15893,33 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_id, __pyx_t_1);
- __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":90
+ /* "cdec/sa/bilex.pxi":97
* self.id2eword[null_word] = "NULL"
* for id, word in enumerate(self.id2eword):
* self.eword2id[word] = id # <<<<<<<<<<<<<<
*
* num_pairs = 0
*/
- if (unlikely(PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_word, __pyx_v_id) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_word, __pyx_v_id) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/bilex.pxi":96
+ * self.id2eword.append(word)
+ * self.id2eword[null_word] = "NULL"
+ * for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<<
+ * self.eword2id[word] = id
+ *
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":92
+ /* "cdec/sa/bilex.pxi":99
* self.eword2id[word] = id
*
* num_pairs = 0 # <<<<<<<<<<<<<<
@@ -15033,7 +15928,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_num_pairs = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":94
+ /* "cdec/sa/bilex.pxi":101
* num_pairs = 0
*
* V_E = len(eda.id2word) # <<<<<<<<<<<<<<
@@ -15042,11 +15937,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_t_1 = __pyx_v_eda->id2word;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_V_E = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":95
+ /* "cdec/sa/bilex.pxi":102
*
* V_E = len(eda.id2word)
* V_F = len(fsa.darray.id2word) # <<<<<<<<<<<<<<
@@ -15055,11 +15950,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_t_1 = __pyx_v_fsa->darray->id2word;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_V_F = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":96
+ /* "cdec/sa/bilex.pxi":103
* V_E = len(eda.id2word)
* V_F = len(fsa.darray.id2word)
* fmargin = <int*> malloc(V_F*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15068,7 +15963,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_fmargin = ((int *)malloc((__pyx_v_V_F * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":97
+ /* "cdec/sa/bilex.pxi":104
* V_F = len(fsa.darray.id2word)
* fmargin = <int*> malloc(V_F*sizeof(int))
* emargin = <int*> malloc(V_E*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15077,7 +15972,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_emargin = ((int *)malloc((__pyx_v_V_E * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":98
+ /* "cdec/sa/bilex.pxi":105
* fmargin = <int*> malloc(V_F*sizeof(int))
* emargin = <int*> malloc(V_E*sizeof(int))
* memset(fmargin, 0, V_F*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15086,7 +15981,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
memset(__pyx_v_fmargin, 0, (__pyx_v_V_F * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":99
+ /* "cdec/sa/bilex.pxi":106
* emargin = <int*> malloc(V_E*sizeof(int))
* memset(fmargin, 0, V_F*sizeof(int))
* memset(emargin, 0, V_E*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15095,7 +15990,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
memset(__pyx_v_emargin, 0, (__pyx_v_V_E * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":101
+ /* "cdec/sa/bilex.pxi":108
* memset(emargin, 0, V_E*sizeof(int))
*
* dict = <_node**> malloc(V_F*sizeof(_node*)) # <<<<<<<<<<<<<<
@@ -15104,7 +15999,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_dict = ((struct __pyx_t_4cdec_2sa_3_sa__node **)malloc((__pyx_v_V_F * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__node *)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":102
+ /* "cdec/sa/bilex.pxi":109
*
* dict = <_node**> malloc(V_F*sizeof(_node*))
* memset(dict, 0, V_F*sizeof(_node*)) # <<<<<<<<<<<<<<
@@ -15113,7 +16008,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__node *))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":104
+ /* "cdec/sa/bilex.pxi":111
* memset(dict, 0, V_F*sizeof(_node*))
*
* num_sents = len(fsa.darray.sent_index) # <<<<<<<<<<<<<<
@@ -15122,27 +16017,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_t_1 = ((PyObject *)__pyx_v_fsa->darray->sent_index);
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_num_sents = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":105
+ /* "cdec/sa/bilex.pxi":112
*
* num_sents = len(fsa.darray.sent_index)
* for sent_id from 0 <= sent_id < num_sents-1: # <<<<<<<<<<<<<<
*
* fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id]
*/
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_num_sents, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_v_num_sents, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (__pyx_v_sent_id = 0; __pyx_v_sent_id < __pyx_t_7; __pyx_v_sent_id++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":107
+ /* "cdec/sa/bilex.pxi":114
* for sent_id from 0 <= sent_id < num_sents-1:
*
* fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id] # <<<<<<<<<<<<<<
@@ -15151,7 +16046,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_fsent = (__pyx_v_fsa->darray->data->arr + (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":108
+ /* "cdec/sa/bilex.pxi":115
*
* fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id]
* I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 # <<<<<<<<<<<<<<
@@ -15160,7 +16055,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_I = (((__pyx_v_fsa->darray->sent_index->arr[(__pyx_v_sent_id + 1)]) - (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":109
+ /* "cdec/sa/bilex.pxi":116
* fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id]
* I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1
* faligned = <int*> malloc(I*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15169,7 +16064,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_faligned = ((int *)malloc((__pyx_v_I * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":110
+ /* "cdec/sa/bilex.pxi":117
* I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1
* faligned = <int*> malloc(I*sizeof(int))
* memset(faligned, 0, I*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15178,7 +16073,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
memset(__pyx_v_faligned, 0, (__pyx_v_I * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":112
+ /* "cdec/sa/bilex.pxi":119
* memset(faligned, 0, I*sizeof(int))
*
* esent = eda.data.arr + eda.sent_index.arr[sent_id] # <<<<<<<<<<<<<<
@@ -15187,7 +16082,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_esent = (__pyx_v_eda->data->arr + (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":113
+ /* "cdec/sa/bilex.pxi":120
*
* esent = eda.data.arr + eda.sent_index.arr[sent_id]
* J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 # <<<<<<<<<<<<<<
@@ -15196,7 +16091,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_J = (((__pyx_v_eda->sent_index->arr[(__pyx_v_sent_id + 1)]) - (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":114
+ /* "cdec/sa/bilex.pxi":121
* esent = eda.data.arr + eda.sent_index.arr[sent_id]
* J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1
* ealigned = <int*> malloc(J*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15205,7 +16100,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_ealigned = ((int *)malloc((__pyx_v_J * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":115
+ /* "cdec/sa/bilex.pxi":122
* J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1
* ealigned = <int*> malloc(J*sizeof(int))
* memset(ealigned, 0, J*sizeof(int)) # <<<<<<<<<<<<<<
@@ -15214,7 +16109,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
memset(__pyx_v_ealigned, 0, (__pyx_v_J * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":117
+ /* "cdec/sa/bilex.pxi":124
* memset(ealigned, 0, J*sizeof(int))
*
* links = aa._get_sent_links(sent_id, &num_links) # <<<<<<<<<<<<<<
@@ -15223,7 +16118,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_links = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_aa->__pyx_vtab)->_get_sent_links(__pyx_v_aa, __pyx_v_sent_id, (&__pyx_v_num_links));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":119
+ /* "cdec/sa/bilex.pxi":126
* links = aa._get_sent_links(sent_id, &num_links)
*
* for l from 0 <= l < num_links: # <<<<<<<<<<<<<<
@@ -15233,7 +16128,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_8 = __pyx_v_num_links;
for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_8; __pyx_v_l++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":120
+ /* "cdec/sa/bilex.pxi":127
*
* for l from 0 <= l < num_links:
* i = links[l*2] # <<<<<<<<<<<<<<
@@ -15242,7 +16137,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_i = (__pyx_v_links[(__pyx_v_l * 2)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":121
+ /* "cdec/sa/bilex.pxi":128
* for l from 0 <= l < num_links:
* i = links[l*2]
* j = links[l*2+1] # <<<<<<<<<<<<<<
@@ -15251,73 +16146,77 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_j = (__pyx_v_links[((__pyx_v_l * 2) + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":122
+ /* "cdec/sa/bilex.pxi":129
* i = links[l*2]
* j = links[l*2+1]
* if i >= I or j >= J: # <<<<<<<<<<<<<<
* raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1))
* f_i = fsent[i]
*/
- __pyx_t_9 = ((__pyx_v_i >= __pyx_v_I) != 0);
- if (!__pyx_t_9) {
- __pyx_t_10 = ((__pyx_v_j >= __pyx_v_J) != 0);
- __pyx_t_11 = __pyx_t_10;
+ __pyx_t_10 = ((__pyx_v_i >= __pyx_v_I) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L17_next_or;
} else {
- __pyx_t_11 = __pyx_t_9;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L16_bool_binop_done;
}
- if (__pyx_t_11) {
+ __pyx_L17_next_or:;
+ __pyx_t_10 = ((__pyx_v_j >= __pyx_v_J) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L16_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":123
+ /* "cdec/sa/bilex.pxi":130
* j = links[l*2+1]
* if i >= I or j >= J:
* raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1)) # <<<<<<<<<<<<<<
* f_i = fsent[i]
* e_j = esent[j]
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_12 = __Pyx_PyInt_From_long((__pyx_v_sent_id + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
- __pyx_t_13 = __Pyx_PyInt_From_long((__pyx_v_sent_id + 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyTuple_New(5); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = PyTuple_New(5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_12);
__Pyx_GIVEREF(__pyx_t_12);
- PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_13);
- __Pyx_GIVEREF(__pyx_t_13);
__pyx_t_1 = 0;
__pyx_t_4 = 0;
__pyx_t_6 = 0;
+ __pyx_t_11 = 0;
__pyx_t_12 = 0;
- __pyx_t_13 = 0;
- __pyx_t_13 = __Pyx_PyString_Format(__pyx_kp_s_d_d_out_of_bounds_I_d_J_d_in_li, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13);
- __Pyx_GIVEREF(__pyx_t_13);
- __pyx_t_13 = 0;
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d_d_out_of_bounds_I_d_J_d_in_li, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_Raise(__pyx_t_13, 0, 0, 0);
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_Raise(__pyx_t_12, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":124
+ /* "cdec/sa/bilex.pxi":131
* if i >= I or j >= J:
* raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1))
* f_i = fsent[i] # <<<<<<<<<<<<<<
@@ -15326,7 +16225,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":125
+ /* "cdec/sa/bilex.pxi":132
* raise Exception("%d-%d out of bounds (I=%d,J=%d) in line %d\n" % (i,j,I,J,sent_id+1))
* f_i = fsent[i]
* e_j = esent[j] # <<<<<<<<<<<<<<
@@ -15335,7 +16234,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":126
+ /* "cdec/sa/bilex.pxi":133
* f_i = fsent[i]
* e_j = esent[j]
* fmargin[f_i] = fmargin[f_i]+1 # <<<<<<<<<<<<<<
@@ -15344,7 +16243,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":127
+ /* "cdec/sa/bilex.pxi":134
* e_j = esent[j]
* fmargin[f_i] = fmargin[f_i]+1
* emargin[e_j] = emargin[e_j]+1 # <<<<<<<<<<<<<<
@@ -15353,17 +16252,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":128
+ /* "cdec/sa/bilex.pxi":135
* fmargin[f_i] = fmargin[f_i]+1
* emargin[e_j] = emargin[e_j]+1
* if dict[f_i] == NULL: # <<<<<<<<<<<<<<
* dict[f_i] = new_node(e_j)
* dict[f_i].val = 1
*/
- __pyx_t_11 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":129
+ /* "cdec/sa/bilex.pxi":136
* emargin[e_j] = emargin[e_j]+1
* if dict[f_i] == NULL:
* dict[f_i] = new_node(e_j) # <<<<<<<<<<<<<<
@@ -15372,7 +16271,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":130
+ /* "cdec/sa/bilex.pxi":137
* if dict[f_i] == NULL:
* dict[f_i] = new_node(e_j)
* dict[f_i].val = 1 # <<<<<<<<<<<<<<
@@ -15381,7 +16280,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_f_i])->val = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":131
+ /* "cdec/sa/bilex.pxi":138
* dict[f_i] = new_node(e_j)
* dict[f_i].val = 1
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15389,11 +16288,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* count = get_val(dict[f_i], e_j)
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L16;
+ goto __pyx_L18;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":133
+ /* "cdec/sa/bilex.pxi":140
* num_pairs = num_pairs + 1
* else:
* count = get_val(dict[f_i], e_j) # <<<<<<<<<<<<<<
@@ -15402,17 +16301,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":134
+ /* "cdec/sa/bilex.pxi":141
* else:
* count = get_val(dict[f_i], e_j)
* if count[0] == 0: # <<<<<<<<<<<<<<
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1
*/
- __pyx_t_11 = (((__pyx_v_count[0]) == 0) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_count[0]) == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":135
+ /* "cdec/sa/bilex.pxi":142
* count = get_val(dict[f_i], e_j)
* if count[0] == 0:
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15420,11 +16319,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* # add count
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L17;
+ goto __pyx_L19;
}
- __pyx_L17:;
+ __pyx_L19:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":136
+ /* "cdec/sa/bilex.pxi":143
* if count[0] == 0:
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1 # <<<<<<<<<<<<<<
@@ -15433,9 +16332,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1);
}
- __pyx_L16:;
+ __pyx_L18:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":138
+ /* "cdec/sa/bilex.pxi":145
* count[0] = count[0] + 1
* # add count
* faligned[i] = 1 # <<<<<<<<<<<<<<
@@ -15444,7 +16343,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_faligned[__pyx_v_i]) = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":139
+ /* "cdec/sa/bilex.pxi":146
* # add count
* faligned[i] = 1
* ealigned[j] = 1 # <<<<<<<<<<<<<<
@@ -15454,7 +16353,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
(__pyx_v_ealigned[__pyx_v_j]) = 1;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":140
+ /* "cdec/sa/bilex.pxi":147
* faligned[i] = 1
* ealigned[j] = 1
* for i from 0 <= i < I: # <<<<<<<<<<<<<<
@@ -15464,17 +16363,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_8 = __pyx_v_I;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":141
+ /* "cdec/sa/bilex.pxi":148
* ealigned[j] = 1
* for i from 0 <= i < I:
* if faligned[i] == 0: # <<<<<<<<<<<<<<
* f_i = fsent[i]
* fmargin[f_i] = fmargin[f_i] + 1
*/
- __pyx_t_11 = (((__pyx_v_faligned[__pyx_v_i]) == 0) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_faligned[__pyx_v_i]) == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":142
+ /* "cdec/sa/bilex.pxi":149
* for i from 0 <= i < I:
* if faligned[i] == 0:
* f_i = fsent[i] # <<<<<<<<<<<<<<
@@ -15483,7 +16382,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":143
+ /* "cdec/sa/bilex.pxi":150
* if faligned[i] == 0:
* f_i = fsent[i]
* fmargin[f_i] = fmargin[f_i] + 1 # <<<<<<<<<<<<<<
@@ -15492,7 +16391,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":144
+ /* "cdec/sa/bilex.pxi":151
* f_i = fsent[i]
* fmargin[f_i] = fmargin[f_i] + 1
* emargin[null_word] = emargin[null_word] + 1 # <<<<<<<<<<<<<<
@@ -15501,17 +16400,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_emargin[__pyx_v_null_word]) = ((__pyx_v_emargin[__pyx_v_null_word]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":145
+ /* "cdec/sa/bilex.pxi":152
* fmargin[f_i] = fmargin[f_i] + 1
* emargin[null_word] = emargin[null_word] + 1
* if dict[f_i] == NULL: # <<<<<<<<<<<<<<
* dict[f_i] = new_node(null_word)
* dict[f_i].val = 1
*/
- __pyx_t_11 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":146
+ /* "cdec/sa/bilex.pxi":153
* emargin[null_word] = emargin[null_word] + 1
* if dict[f_i] == NULL:
* dict[f_i] = new_node(null_word) # <<<<<<<<<<<<<<
@@ -15520,7 +16419,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_null_word);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":147
+ /* "cdec/sa/bilex.pxi":154
* if dict[f_i] == NULL:
* dict[f_i] = new_node(null_word)
* dict[f_i].val = 1 # <<<<<<<<<<<<<<
@@ -15529,7 +16428,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_f_i])->val = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":148
+ /* "cdec/sa/bilex.pxi":155
* dict[f_i] = new_node(null_word)
* dict[f_i].val = 1
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15537,11 +16436,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* count = get_val(dict[f_i], null_word)
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L21;
+ goto __pyx_L23;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":150
+ /* "cdec/sa/bilex.pxi":157
* num_pairs = num_pairs + 1
* else:
* count = get_val(dict[f_i], null_word) # <<<<<<<<<<<<<<
@@ -15550,17 +16449,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":151
+ /* "cdec/sa/bilex.pxi":158
* else:
* count = get_val(dict[f_i], null_word)
* if count[0] == 0: # <<<<<<<<<<<<<<
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1
*/
- __pyx_t_11 = (((__pyx_v_count[0]) == 0) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_count[0]) == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":152
+ /* "cdec/sa/bilex.pxi":159
* count = get_val(dict[f_i], null_word)
* if count[0] == 0:
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15568,11 +16467,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* for j from 0 <= j < J:
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L22;
+ goto __pyx_L24;
}
- __pyx_L22:;
+ __pyx_L24:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":153
+ /* "cdec/sa/bilex.pxi":160
* if count[0] == 0:
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1 # <<<<<<<<<<<<<<
@@ -15581,13 +16480,13 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1);
}
- __pyx_L21:;
- goto __pyx_L20;
+ __pyx_L23:;
+ goto __pyx_L22;
}
- __pyx_L20:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":154
+ /* "cdec/sa/bilex.pxi":161
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1
* for j from 0 <= j < J: # <<<<<<<<<<<<<<
@@ -15597,17 +16496,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_8 = __pyx_v_J;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_8; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":155
+ /* "cdec/sa/bilex.pxi":162
* count[0] = count[0] + 1
* for j from 0 <= j < J:
* if ealigned[j] == 0: # <<<<<<<<<<<<<<
* e_j = esent[j]
* fmargin[null_word] = fmargin[null_word] + 1
*/
- __pyx_t_11 = (((__pyx_v_ealigned[__pyx_v_j]) == 0) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_ealigned[__pyx_v_j]) == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":156
+ /* "cdec/sa/bilex.pxi":163
* for j from 0 <= j < J:
* if ealigned[j] == 0:
* e_j = esent[j] # <<<<<<<<<<<<<<
@@ -15616,7 +16515,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":157
+ /* "cdec/sa/bilex.pxi":164
* if ealigned[j] == 0:
* e_j = esent[j]
* fmargin[null_word] = fmargin[null_word] + 1 # <<<<<<<<<<<<<<
@@ -15625,7 +16524,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_fmargin[__pyx_v_null_word]) = ((__pyx_v_fmargin[__pyx_v_null_word]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":158
+ /* "cdec/sa/bilex.pxi":165
* e_j = esent[j]
* fmargin[null_word] = fmargin[null_word] + 1
* emargin[e_j] = emargin[e_j] + 1 # <<<<<<<<<<<<<<
@@ -15634,17 +16533,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":159
+ /* "cdec/sa/bilex.pxi":166
* fmargin[null_word] = fmargin[null_word] + 1
* emargin[e_j] = emargin[e_j] + 1
* if dict[null_word] == NULL: # <<<<<<<<<<<<<<
* dict[null_word] = new_node(e_j)
* dict[null_word].val = 1
*/
- __pyx_t_11 = (((__pyx_v_dict[__pyx_v_null_word]) == NULL) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_dict[__pyx_v_null_word]) == NULL) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":160
+ /* "cdec/sa/bilex.pxi":167
* emargin[e_j] = emargin[e_j] + 1
* if dict[null_word] == NULL:
* dict[null_word] = new_node(e_j) # <<<<<<<<<<<<<<
@@ -15653,7 +16552,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":161
+ /* "cdec/sa/bilex.pxi":168
* if dict[null_word] == NULL:
* dict[null_word] = new_node(e_j)
* dict[null_word].val = 1 # <<<<<<<<<<<<<<
@@ -15662,7 +16561,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_dict[__pyx_v_null_word])->val = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":162
+ /* "cdec/sa/bilex.pxi":169
* dict[null_word] = new_node(e_j)
* dict[null_word].val = 1
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15670,11 +16569,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* count = get_val(dict[null_word], e_j)
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L26;
+ goto __pyx_L28;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":164
+ /* "cdec/sa/bilex.pxi":171
* num_pairs = num_pairs + 1
* else:
* count = get_val(dict[null_word], e_j) # <<<<<<<<<<<<<<
@@ -15683,17 +16582,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":165
+ /* "cdec/sa/bilex.pxi":172
* else:
* count = get_val(dict[null_word], e_j)
* if count[0] == 0: # <<<<<<<<<<<<<<
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1
*/
- __pyx_t_11 = (((__pyx_v_count[0]) == 0) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_count[0]) == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":166
+ /* "cdec/sa/bilex.pxi":173
* count = get_val(dict[null_word], e_j)
* if count[0] == 0:
* num_pairs = num_pairs + 1 # <<<<<<<<<<<<<<
@@ -15701,11 +16600,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
* free(links)
*/
__pyx_v_num_pairs = (__pyx_v_num_pairs + 1);
- goto __pyx_L27;
+ goto __pyx_L29;
}
- __pyx_L27:;
+ __pyx_L29:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":167
+ /* "cdec/sa/bilex.pxi":174
* if count[0] == 0:
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1 # <<<<<<<<<<<<<<
@@ -15714,13 +16613,13 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
(__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1);
}
- __pyx_L26:;
- goto __pyx_L25;
+ __pyx_L28:;
+ goto __pyx_L27;
}
- __pyx_L25:;
+ __pyx_L27:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":168
+ /* "cdec/sa/bilex.pxi":175
* num_pairs = num_pairs + 1
* count[0] = count[0] + 1
* free(links) # <<<<<<<<<<<<<<
@@ -15729,7 +16628,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
free(__pyx_v_links);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":169
+ /* "cdec/sa/bilex.pxi":176
* count[0] = count[0] + 1
* free(links)
* free(faligned) # <<<<<<<<<<<<<<
@@ -15738,7 +16637,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
free(__pyx_v_faligned);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":170
+ /* "cdec/sa/bilex.pxi":177
* free(links)
* free(faligned)
* free(ealigned) # <<<<<<<<<<<<<<
@@ -15748,95 +16647,95 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
free(__pyx_v_ealigned);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":171
+ /* "cdec/sa/bilex.pxi":178
* free(faligned)
* free(ealigned)
* self.f_index = IntList(initial_len=V_F) # <<<<<<<<<<<<<<
* self.e_index = IntList(initial_len=num_pairs)
* self.col1 = FloatList(initial_len=num_pairs)
*/
- __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_V_F); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_V_F); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_initial_len, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_initial_len, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GIVEREF(__pyx_t_13);
__Pyx_GOTREF(__pyx_v_self->f_index);
__Pyx_DECREF(((PyObject *)__pyx_v_self->f_index));
- __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_14);
- __pyx_t_14 = 0;
+ __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_13);
+ __pyx_t_13 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":172
+ /* "cdec/sa/bilex.pxi":179
* free(ealigned)
* self.f_index = IntList(initial_len=V_F)
* self.e_index = IntList(initial_len=num_pairs) # <<<<<<<<<<<<<<
* self.col1 = FloatList(initial_len=num_pairs)
* self.col2 = FloatList(initial_len=num_pairs)
*/
- __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_initial_len, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_initial_len, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_GIVEREF(__pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_v_self->e_index);
__Pyx_DECREF(((PyObject *)__pyx_v_self->e_index));
- __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_13);
- __pyx_t_13 = 0;
+ __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":173
+ /* "cdec/sa/bilex.pxi":180
* self.f_index = IntList(initial_len=V_F)
* self.e_index = IntList(initial_len=num_pairs)
* self.col1 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<<
* self.col2 = FloatList(initial_len=num_pairs)
*
*/
- __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_initial_len, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_initial_len, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GIVEREF(__pyx_t_13);
__Pyx_GOTREF(__pyx_v_self->col1);
__Pyx_DECREF(((PyObject *)__pyx_v_self->col1));
- __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_14);
- __pyx_t_14 = 0;
+ __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_13);
+ __pyx_t_13 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":174
+ /* "cdec/sa/bilex.pxi":181
* self.e_index = IntList(initial_len=num_pairs)
* self.col1 = FloatList(initial_len=num_pairs)
* self.col2 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<<
*
* num_pairs = 0
*/
- __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_initial_len, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_initial_len, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_GIVEREF(__pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_v_self->col2);
__Pyx_DECREF(((PyObject *)__pyx_v_self->col2));
- __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_13);
- __pyx_t_13 = 0;
+ __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":176
+ /* "cdec/sa/bilex.pxi":183
* self.col2 = FloatList(initial_len=num_pairs)
*
* num_pairs = 0 # <<<<<<<<<<<<<<
@@ -15845,7 +16744,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
__pyx_v_num_pairs = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":177
+ /* "cdec/sa/bilex.pxi":184
*
* num_pairs = 0
* for i from 0 <= i < V_F: # <<<<<<<<<<<<<<
@@ -15855,7 +16754,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_t_7 = __pyx_v_V_F;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":179
+ /* "cdec/sa/bilex.pxi":186
* for i from 0 <= i < V_F:
* #self.f_index[i] = num_pairs
* self.f_index.set(i, num_pairs) # <<<<<<<<<<<<<<
@@ -15864,43 +16763,43 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->set(__pyx_v_self->f_index, __pyx_v_i, __pyx_v_num_pairs);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":180
+ /* "cdec/sa/bilex.pxi":187
* #self.f_index[i] = num_pairs
* self.f_index.set(i, num_pairs)
* if dict[i] != NULL: # <<<<<<<<<<<<<<
* self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin)
* del_node(dict[i])
*/
- __pyx_t_11 = (((__pyx_v_dict[__pyx_v_i]) != NULL) != 0);
- if (__pyx_t_11) {
+ __pyx_t_9 = (((__pyx_v_dict[__pyx_v_i]) != NULL) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":181
+ /* "cdec/sa/bilex.pxi":188
* self.f_index.set(i, num_pairs)
* if dict[i] != NULL:
* self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) # <<<<<<<<<<<<<<
* del_node(dict[i])
* free(fmargin)
*/
- __pyx_t_13 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, (__pyx_v_dict[__pyx_v_i]), (&__pyx_v_num_pairs), ((double)(__pyx_v_fmargin[__pyx_v_i])), __pyx_v_emargin); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_12 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, (__pyx_v_dict[__pyx_v_i]), (&__pyx_v_num_pairs), ((double)(__pyx_v_fmargin[__pyx_v_i])), __pyx_v_emargin); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":182
+ /* "cdec/sa/bilex.pxi":189
* if dict[i] != NULL:
* self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin)
* del_node(dict[i]) # <<<<<<<<<<<<<<
* free(fmargin)
* free(emargin)
*/
- __pyx_t_13 = __pyx_f_4cdec_2sa_3_sa_del_node((__pyx_v_dict[__pyx_v_i])); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- goto __pyx_L30;
+ __pyx_t_12 = __pyx_f_4cdec_2sa_3_sa_del_node((__pyx_v_dict[__pyx_v_i])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ goto __pyx_L32;
}
- __pyx_L30:;
+ __pyx_L32:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":183
+ /* "cdec/sa/bilex.pxi":190
* self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin)
* del_node(dict[i])
* free(fmargin) # <<<<<<<<<<<<<<
@@ -15909,7 +16808,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
free(__pyx_v_fmargin);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":184
+ /* "cdec/sa/bilex.pxi":191
* del_node(dict[i])
* free(fmargin)
* free(emargin) # <<<<<<<<<<<<<<
@@ -15918,7 +16817,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
free(__pyx_v_emargin);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":185
+ /* "cdec/sa/bilex.pxi":192
* free(fmargin)
* free(emargin)
* free(dict) # <<<<<<<<<<<<<<
@@ -15927,7 +16826,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
*/
free(__pyx_v_dict);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":186
+ /* "cdec/sa/bilex.pxi":193
* free(emargin)
* free(dict)
* return # <<<<<<<<<<<<<<
@@ -15938,12 +16837,12 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":72
+ /* "cdec/sa/bilex.pxi":72
*
*
* cdef compute_from_data(self, SuffixArray fsa, DataArray eda, Alignment aa): # <<<<<<<<<<<<<<
* cdef int sent_id, num_links, l, i, j, f_i, e_j, I, J, V_E, V_F, num_pairs
- * cdef int *fsent, *esent, *alignment, *links, *ealigned, *faligned
+ * cdef int *fsent
*/
/* function exit code */
@@ -15951,9 +16850,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_13);
- __Pyx_XDECREF(__pyx_t_14);
__Pyx_AddTraceback("cdec.sa._sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -15965,7 +16864,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":189
+/* "cdec/sa/bilex.pxi":196
*
*
* cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<<
@@ -15984,7 +16883,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_add_node", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":191
+ /* "cdec/sa/bilex.pxi":198
* cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin):
* cdef int loc
* if n.smaller != NULL: # <<<<<<<<<<<<<<
@@ -15994,21 +16893,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
__pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":192
+ /* "cdec/sa/bilex.pxi":199
* cdef int loc
* if n.smaller != NULL:
* self._add_node(n.smaller, num_pairs, fmargin, emargin) # <<<<<<<<<<<<<<
* loc = num_pairs[0]
* self.e_index.set(loc, n.key)
*/
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, __pyx_v_n->smaller, __pyx_v_num_pairs, __pyx_v_fmargin, __pyx_v_emargin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, __pyx_v_n->smaller, __pyx_v_num_pairs, __pyx_v_fmargin, __pyx_v_emargin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":193
+ /* "cdec/sa/bilex.pxi":200
* if n.smaller != NULL:
* self._add_node(n.smaller, num_pairs, fmargin, emargin)
* loc = num_pairs[0] # <<<<<<<<<<<<<<
@@ -16017,7 +16916,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
*/
__pyx_v_loc = (__pyx_v_num_pairs[0]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":194
+ /* "cdec/sa/bilex.pxi":201
* self._add_node(n.smaller, num_pairs, fmargin, emargin)
* loc = num_pairs[0]
* self.e_index.set(loc, n.key) # <<<<<<<<<<<<<<
@@ -16026,7 +16925,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->set(__pyx_v_self->e_index, __pyx_v_loc, __pyx_v_n->key);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":195
+ /* "cdec/sa/bilex.pxi":202
* loc = num_pairs[0]
* self.e_index.set(loc, n.key)
* self.col1.set(loc, float(n.val)/fmargin) # <<<<<<<<<<<<<<
@@ -16041,11 +16940,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->set(__pyx_v_self->col1, __pyx_v_loc, (((double)__pyx_v_n->val) / __pyx_v_fmargin));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":196
+ /* "cdec/sa/bilex.pxi":203
* self.e_index.set(loc, n.key)
* self.col1.set(loc, float(n.val)/fmargin)
* self.col2.set(loc, float(n.val)/float(emargin[n.key])) # <<<<<<<<<<<<<<
@@ -16060,11 +16959,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->set(__pyx_v_self->col2, __pyx_v_loc, (((double)__pyx_v_n->val) / ((double)(__pyx_v_emargin[__pyx_v_n->key]))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":197
+ /* "cdec/sa/bilex.pxi":204
* self.col1.set(loc, float(n.val)/fmargin)
* self.col2.set(loc, float(n.val)/float(emargin[n.key]))
* num_pairs[0] = loc + 1 # <<<<<<<<<<<<<<
@@ -16073,7 +16972,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
*/
(__pyx_v_num_pairs[0]) = (__pyx_v_loc + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":198
+ /* "cdec/sa/bilex.pxi":205
* self.col2.set(loc, float(n.val)/float(emargin[n.key]))
* num_pairs[0] = loc + 1
* if n.bigger != NULL: # <<<<<<<<<<<<<<
@@ -16083,21 +16982,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
__pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":199
+ /* "cdec/sa/bilex.pxi":206
* num_pairs[0] = loc + 1
* if n.bigger != NULL:
* self._add_node(n.bigger, num_pairs, fmargin, emargin) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, __pyx_v_n->bigger, __pyx_v_num_pairs, __pyx_v_fmargin, __pyx_v_emargin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->_add_node(__pyx_v_self, __pyx_v_n->bigger, __pyx_v_num_pairs, __pyx_v_fmargin, __pyx_v_emargin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L4;
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":189
+ /* "cdec/sa/bilex.pxi":196
*
*
* cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<<
@@ -16118,7 +17017,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":202
+/* "cdec/sa/bilex.pxi":209
*
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -16137,7 +17036,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_binary (wrapper)", 0);
assert(__pyx_arg_filename); {
- __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -16163,7 +17062,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":204
+ /* "cdec/sa/bilex.pxi":211
* def write_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -16172,7 +17071,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":205
+ /* "cdec/sa/bilex.pxi":212
* cdef FILE* f
* f = fopen(filename, "w")
* self.f_index.write_handle(f) # <<<<<<<<<<<<<<
@@ -16181,7 +17080,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->write_handle(__pyx_v_self->f_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":206
+ /* "cdec/sa/bilex.pxi":213
* f = fopen(filename, "w")
* self.f_index.write_handle(f)
* self.e_index.write_handle(f) # <<<<<<<<<<<<<<
@@ -16190,7 +17089,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->write_handle(__pyx_v_self->e_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":207
+ /* "cdec/sa/bilex.pxi":214
* self.f_index.write_handle(f)
* self.e_index.write_handle(f)
* self.col1.write_handle(f) # <<<<<<<<<<<<<<
@@ -16199,7 +17098,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":208
+ /* "cdec/sa/bilex.pxi":215
* self.e_index.write_handle(f)
* self.col1.write_handle(f)
* self.col2.write_handle(f) # <<<<<<<<<<<<<<
@@ -16208,7 +17107,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":209
+ /* "cdec/sa/bilex.pxi":216
* self.col1.write_handle(f)
* self.col2.write_handle(f)
* self.write_wordlist(self.id2fword, f) # <<<<<<<<<<<<<<
@@ -16217,12 +17116,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
__pyx_t_1 = __pyx_v_self->id2fword;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":210
+ /* "cdec/sa/bilex.pxi":217
* self.col2.write_handle(f)
* self.write_wordlist(self.id2fword, f)
* self.write_wordlist(self.id2eword, f) # <<<<<<<<<<<<<<
@@ -16231,12 +17130,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
__pyx_t_2 = __pyx_v_self->id2eword;
__Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->write_wordlist(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":211
+ /* "cdec/sa/bilex.pxi":218
* self.write_wordlist(self.id2fword, f)
* self.write_wordlist(self.id2eword, f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -16245,7 +17144,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":202
+ /* "cdec/sa/bilex.pxi":209
*
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -16267,7 +17166,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":214
+/* "cdec/sa/bilex.pxi":221
*
*
* cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<<
@@ -16292,17 +17191,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_wordlist", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":218
+ /* "cdec/sa/bilex.pxi":225
* cdef int num_words
*
* num_words = len(wordlist) # <<<<<<<<<<<<<<
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in wordlist:
*/
- __pyx_t_1 = PyObject_Length(__pyx_v_wordlist); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Length(__pyx_v_wordlist); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_num_words = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":219
+ /* "cdec/sa/bilex.pxi":226
*
* num_words = len(wordlist)
* fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -16311,43 +17210,45 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
*/
fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":220
+ /* "cdec/sa/bilex.pxi":227
* num_words = len(wordlist)
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in wordlist: # <<<<<<<<<<<<<<
* word_len = len(word) + 1
* fwrite(&(word_len), sizeof(int), 1, f)
*/
- if (PyList_CheckExact(__pyx_v_wordlist) || PyTuple_CheckExact(__pyx_v_wordlist)) {
+ if (likely(PyList_CheckExact(__pyx_v_wordlist)) || PyTuple_CheckExact(__pyx_v_wordlist)) {
__pyx_t_2 = __pyx_v_wordlist; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_wordlist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_wordlist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_2);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -16356,17 +17257,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
__Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":221
+ /* "cdec/sa/bilex.pxi":228
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in wordlist:
* word_len = len(word) + 1 # <<<<<<<<<<<<<<
* fwrite(&(word_len), sizeof(int), 1, f)
* fwrite(<char *>word, sizeof(char), word_len, f)
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_word_len = (__pyx_t_5 + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":222
+ /* "cdec/sa/bilex.pxi":229
* for word in wordlist:
* word_len = len(word) + 1
* fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -16375,19 +17276,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
*/
fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":223
+ /* "cdec/sa/bilex.pxi":230
* word_len = len(word) + 1
* fwrite(&(word_len), sizeof(int), 1, f)
* fwrite(<char *>word, sizeof(char), word_len, f) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_word); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_word); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
fwrite(((char *)__pyx_t_6), (sizeof(char)), __pyx_v_word_len, __pyx_v_f);
+
+ /* "cdec/sa/bilex.pxi":227
+ * num_words = len(wordlist)
+ * fwrite(&(num_words), sizeof(int), 1, f)
+ * for word in wordlist: # <<<<<<<<<<<<<<
+ * word_len = len(word) + 1
+ * fwrite(&(word_len), sizeof(int), 1, f)
+ */
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":214
+ /* "cdec/sa/bilex.pxi":221
*
*
* cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<<
@@ -16410,7 +17319,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED stru
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":226
+/* "cdec/sa/bilex.pxi":233
*
*
* cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<<
@@ -16435,7 +17344,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_wordlist", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":231
+ /* "cdec/sa/bilex.pxi":238
* cdef char* word
*
* fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -16444,7 +17353,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
*/
fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":232
+ /* "cdec/sa/bilex.pxi":239
*
* fread(&(num_words), sizeof(int), 1, f)
* for i from 0 <= i < num_words: # <<<<<<<<<<<<<<
@@ -16454,7 +17363,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
__pyx_t_1 = __pyx_v_num_words;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":233
+ /* "cdec/sa/bilex.pxi":240
* fread(&(num_words), sizeof(int), 1, f)
* for i from 0 <= i < num_words:
* fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -16463,7 +17372,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
*/
fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":234
+ /* "cdec/sa/bilex.pxi":241
* for i from 0 <= i < num_words:
* fread(&(word_len), sizeof(int), 1, f)
* word = <char*> malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<<
@@ -16472,7 +17381,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
*/
__pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":235
+ /* "cdec/sa/bilex.pxi":242
* fread(&(word_len), sizeof(int), 1, f)
* word = <char*> malloc (word_len * sizeof(char))
* fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<<
@@ -16481,35 +17390,35 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
*/
fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":236
+ /* "cdec/sa/bilex.pxi":243
* word = <char*> malloc (word_len * sizeof(char))
* fread(word, sizeof(char), word_len, f)
* word2id[word] = len(id2word) # <<<<<<<<<<<<<<
* id2word.append(word)
* free(word)
*/
- __pyx_t_2 = PyObject_Length(__pyx_v_id2word); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_v_id2word); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(PyObject_SetItem(__pyx_v_word2id, __pyx_t_4, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_word2id, __pyx_t_4, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":237
+ /* "cdec/sa/bilex.pxi":244
* fread(word, sizeof(char), word_len, f)
* word2id[word] = len(id2word)
* id2word.append(word) # <<<<<<<<<<<<<<
* free(word)
*
*/
- __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_id2word, __pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_id2word, __pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":238
+ /* "cdec/sa/bilex.pxi":245
* word2id[word] = len(id2word)
* id2word.append(word)
* free(word) # <<<<<<<<<<<<<<
@@ -16519,7 +17428,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
free(__pyx_v_word);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":226
+ /* "cdec/sa/bilex.pxi":233
*
*
* cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<<
@@ -16541,7 +17450,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struc
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":240
+/* "cdec/sa/bilex.pxi":247
* free(word)
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -16560,7 +17469,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_binary (wrapper)", 0);
assert(__pyx_arg_filename); {
- __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -16587,7 +17496,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":242
+ /* "cdec/sa/bilex.pxi":249
* def read_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -16596,7 +17505,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":243
+ /* "cdec/sa/bilex.pxi":250
* cdef FILE* f
* f = fopen(filename, "r")
* self.f_index.read_handle(f) # <<<<<<<<<<<<<<
@@ -16605,7 +17514,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->read_handle(__pyx_v_self->f_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":244
+ /* "cdec/sa/bilex.pxi":251
* f = fopen(filename, "r")
* self.f_index.read_handle(f)
* self.e_index.read_handle(f) # <<<<<<<<<<<<<<
@@ -16614,7 +17523,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->read_handle(__pyx_v_self->e_index, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":245
+ /* "cdec/sa/bilex.pxi":252
* self.f_index.read_handle(f)
* self.e_index.read_handle(f)
* self.col1.read_handle(f) # <<<<<<<<<<<<<<
@@ -16623,7 +17532,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":246
+ /* "cdec/sa/bilex.pxi":253
* self.e_index.read_handle(f)
* self.col1.read_handle(f)
* self.col2.read_handle(f) # <<<<<<<<<<<<<<
@@ -16632,7 +17541,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":247
+ /* "cdec/sa/bilex.pxi":254
* self.col1.read_handle(f)
* self.col2.read_handle(f)
* self.read_wordlist(self.fword2id, self.id2fword, f) # <<<<<<<<<<<<<<
@@ -16643,13 +17552,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __pyx_v_self->id2fword;
__Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_1, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_1, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":248
+ /* "cdec/sa/bilex.pxi":255
* self.col2.read_handle(f)
* self.read_wordlist(self.fword2id, self.id2fword, f)
* self.read_wordlist(self.eword2id, self.id2eword, f) # <<<<<<<<<<<<<<
@@ -16660,13 +17569,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
__Pyx_INCREF(__pyx_t_3);
__pyx_t_2 = __pyx_v_self->id2eword;
__Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_3, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->read_wordlist(__pyx_v_self, __pyx_t_3, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":249
+ /* "cdec/sa/bilex.pxi":256
* self.read_wordlist(self.fword2id, self.id2fword, f)
* self.read_wordlist(self.eword2id, self.id2eword, f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -16675,7 +17584,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":240
+ /* "cdec/sa/bilex.pxi":247
* free(word)
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -16698,7 +17607,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252
+/* "cdec/sa/bilex.pxi":259
*
*
* def contains_e_word(self, eword): # <<<<<<<<<<<<<<
@@ -16729,7 +17638,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("contains_e_word", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253
+ /* "cdec/sa/bilex.pxi":260
*
* def contains_e_word(self, eword):
* return (eword in self.eword2id) # <<<<<<<<<<<<<<
@@ -16737,14 +17646,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(struct __pyx_ob
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252
+ /* "cdec/sa/bilex.pxi":259
*
*
* def contains_e_word(self, eword): # <<<<<<<<<<<<<<
@@ -16763,7 +17672,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6contains_e_word(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256
+/* "cdec/sa/bilex.pxi":263
*
*
* def contains_f_word(self, fword): # <<<<<<<<<<<<<<
@@ -16794,7 +17703,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(struct __pyx_ob
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("contains_f_word", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257
+ /* "cdec/sa/bilex.pxi":264
*
* def contains_f_word(self, fword):
* return (fword in self.fword2id) # <<<<<<<<<<<<<<
@@ -16802,14 +17711,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(struct __pyx_ob
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256
+ /* "cdec/sa/bilex.pxi":263
*
*
* def contains_f_word(self, fword): # <<<<<<<<<<<<<<
@@ -16828,7 +17737,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8contains_f_word(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260
+/* "cdec/sa/bilex.pxi":267
*
*
* def get_e_id(self, eword): # <<<<<<<<<<<<<<
@@ -16863,18 +17772,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_e_id", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261
+ /* "cdec/sa/bilex.pxi":268
*
* def get_e_id(self, eword):
* if eword not in self.eword2id: # <<<<<<<<<<<<<<
* e_id = len(self.id2eword)
* self.id2eword.append(eword)
*/
- __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262
+ /* "cdec/sa/bilex.pxi":269
* def get_e_id(self, eword):
* if eword not in self.eword2id:
* e_id = len(self.id2eword) # <<<<<<<<<<<<<<
@@ -16883,35 +17792,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cde
*/
__pyx_t_3 = __pyx_v_self->id2eword;
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_e_id = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263
+ /* "cdec/sa/bilex.pxi":270
* if eword not in self.eword2id:
* e_id = len(self.id2eword)
* self.id2eword.append(eword) # <<<<<<<<<<<<<<
* self.eword2id[eword] = e_id
* return self.eword2id[eword]
*/
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264
+ /* "cdec/sa/bilex.pxi":271
* e_id = len(self.id2eword)
* self.id2eword.append(eword)
* self.eword2id[eword] = e_id # <<<<<<<<<<<<<<
* return self.eword2id[eword]
*
*/
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_e_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_e_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (unlikely(PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265
+ /* "cdec/sa/bilex.pxi":272
* self.id2eword.append(eword)
* self.eword2id[eword] = e_id
* return self.eword2id[eword] # <<<<<<<<<<<<<<
@@ -16919,13 +17828,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cde
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260
+ /* "cdec/sa/bilex.pxi":267
*
*
* def get_e_id(self, eword): # <<<<<<<<<<<<<<
@@ -16944,7 +17853,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10get_e_id(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268
+/* "cdec/sa/bilex.pxi":275
*
*
* def get_f_id(self, fword): # <<<<<<<<<<<<<<
@@ -16979,18 +17888,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_f_id", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":269
+ /* "cdec/sa/bilex.pxi":276
*
* def get_f_id(self, fword):
* if fword not in self.fword2id: # <<<<<<<<<<<<<<
* f_id = len(self.id2fword)
* self.id2fword.append(fword)
*/
- __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":270
+ /* "cdec/sa/bilex.pxi":277
* def get_f_id(self, fword):
* if fword not in self.fword2id:
* f_id = len(self.id2fword) # <<<<<<<<<<<<<<
@@ -16999,35 +17908,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cde
*/
__pyx_t_3 = __pyx_v_self->id2fword;
__Pyx_INCREF(__pyx_t_3);
- __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_f_id = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":271
+ /* "cdec/sa/bilex.pxi":278
* if fword not in self.fword2id:
* f_id = len(self.id2fword)
* self.id2fword.append(fword) # <<<<<<<<<<<<<<
* self.fword2id[fword] = f_id
* return self.fword2id[fword]
*/
- __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272
+ /* "cdec/sa/bilex.pxi":279
* f_id = len(self.id2fword)
* self.id2fword.append(fword)
* self.fword2id[fword] = f_id # <<<<<<<<<<<<<<
* return self.fword2id[fword]
*
*/
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (unlikely(PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273
+ /* "cdec/sa/bilex.pxi":280
* self.id2fword.append(fword)
* self.fword2id[fword] = f_id
* return self.fword2id[fword] # <<<<<<<<<<<<<<
@@ -17035,13 +17944,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cde
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268
+ /* "cdec/sa/bilex.pxi":275
*
*
* def get_f_id(self, fword): # <<<<<<<<<<<<<<
@@ -17060,7 +17969,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12get_f_id(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276
+/* "cdec/sa/bilex.pxi":283
*
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -17079,7 +17988,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text(PyObject *__pyx_v_se
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_text (wrapper)", 0);
assert(__pyx_arg_filename); {
- __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -17119,10 +18028,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
- PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ Py_ssize_t __pyx_t_10;
+ PyObject *(*__pyx_t_11)(PyObject *);
PyObject *__pyx_t_12 = NULL;
PyObject *__pyx_t_13 = NULL;
PyObject *(*__pyx_t_14)(PyObject *);
@@ -17142,19 +18051,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280
+ /* "cdec/sa/bilex.pxi":287
* cdef IntList fcount
*
* fcount = IntList() # <<<<<<<<<<<<<<
* with gzip_or_text(filename) as f:
* # first loop merely establishes size of array objects
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_fcount = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
+ /* "cdec/sa/bilex.pxi":288
*
* fcount = IntList()
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
@@ -17162,97 +18071,147 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
* for line in f:
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gzip_or_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
- __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_v_f = __pyx_t_1;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_f = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":283
+ /* "cdec/sa/bilex.pxi":290
* with gzip_or_text(filename) as f:
* # first loop merely establishes size of array objects
* for line in f: # <<<<<<<<<<<<<<
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword)
*/
- if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) {
- __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_f)) || PyTuple_CheckExact(__pyx_v_f)) {
+ __pyx_t_5 = __pyx_v_f; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
+ __pyx_t_11 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_11)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_1 = __pyx_t_11(__pyx_t_5);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
- __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_2);
- __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284
+ /* "cdec/sa/bilex.pxi":291
* # first loop merely establishes size of array objects
* for line in f:
* (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<<
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword)
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -17261,111 +18220,143 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
if (unlikely(size != 4)) {
if (size > 4) __Pyx_RaiseTooManyValuesError(4);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
__pyx_t_12 = PyTuple_GET_ITEM(sequence, 3);
} else {
__pyx_t_2 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
__pyx_t_12 = PyList_GET_ITEM(sequence, 3);
}
__Pyx_INCREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_t_10);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_12);
#else
{
Py_ssize_t i;
- PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
+ PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_12};
for (i=0; i < 4; i++) {
- PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
- __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_12};
+ __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
for (index=0; index < 4; index++) {
- PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L18_unpacking_failed;
+ PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L17_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_14 = NULL;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- goto __pyx_L19_unpacking_done;
- __pyx_L18_unpacking_failed:;
+ goto __pyx_L18_unpacking_done;
+ __pyx_L17_unpacking_failed:;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_14 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L19_unpacking_done:;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_L18_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_fword, __pyx_t_2);
__pyx_t_2 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_10);
- __pyx_t_10 = 0;
- __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_4);
+ __pyx_t_4 = 0;
__Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285
+ /* "cdec/sa/bilex.pxi":292
* for line in f:
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword) # <<<<<<<<<<<<<<
* e_id = self.get_e_id(eword)
* while f_id >= len(fcount):
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_f_id); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_INCREF(__pyx_v_fword);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_fword);
- __Pyx_GIVEREF(__pyx_v_fword);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_fword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_fword);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_fword);
+ __Pyx_GIVEREF(__pyx_v_fword);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286
+ /* "cdec/sa/bilex.pxi":293
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword) # <<<<<<<<<<<<<<
* while f_id >= len(fcount):
* fcount.append(0)
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_e_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_e_id); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_INCREF(__pyx_v_eword);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_eword);
- __Pyx_GIVEREF(__pyx_v_eword);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_12, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_eword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_eword);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_eword);
+ __Pyx_GIVEREF(__pyx_v_eword);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287
+ /* "cdec/sa/bilex.pxi":294
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword)
* while f_id >= len(fcount): # <<<<<<<<<<<<<<
@@ -17373,39 +18364,47 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
* fcount.arr[f_id] = fcount.arr[f_id] + 1
*/
while (1) {
- __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_15 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_12 = PyObject_RichCompare(__pyx_v_f_id, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
if (!__pyx_t_16) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288
+ /* "cdec/sa/bilex.pxi":295
* e_id = self.get_e_id(eword)
* while f_id >= len(fcount):
* fcount.append(0) # <<<<<<<<<<<<<<
* fcount.arr[f_id] = fcount.arr[f_id] + 1
*
*/
- __pyx_t_17 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_17 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289
+ /* "cdec/sa/bilex.pxi":296
* while f_id >= len(fcount):
* fcount.append(0)
* fcount.arr[f_id] = fcount.arr[f_id] + 1 # <<<<<<<<<<<<<<
*
* # Allocate space for dictionary in arrays
*/
- __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
(__pyx_v_fcount->arr[__pyx_t_18]) = ((__pyx_v_fcount->arr[__pyx_t_15]) + 1);
+
+ /* "cdec/sa/bilex.pxi":290
+ * with gzip_or_text(filename) as f:
+ * # first loop merely establishes size of array objects
+ * for line in f: # <<<<<<<<<<<<<<
+ * (fword, eword, score1, score2) = line.split()
+ * f_id = self.get_f_id(fword)
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292
+ /* "cdec/sa/bilex.pxi":299
*
* # Allocate space for dictionary in arrays
* N = 0 # <<<<<<<<<<<<<<
@@ -17415,225 +18414,227 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
__Pyx_INCREF(__pyx_int_0);
__pyx_v_N = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293
+ /* "cdec/sa/bilex.pxi":300
* # Allocate space for dictionary in arrays
* N = 0
* n_f = len(fcount) # <<<<<<<<<<<<<<
* self.f_index = IntList(initial_len=n_f+1)
* for i from 0 <= i < n_f:
*/
- __pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_v_n_f = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_fcount)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_v_n_f = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294
+ /* "cdec/sa/bilex.pxi":301
* N = 0
* n_f = len(fcount)
* self.f_index = IntList(initial_len=n_f+1) # <<<<<<<<<<<<<<
* for i from 0 <= i < n_f:
* self.f_index.arr[i] = N
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = PyNumber_Add(__pyx_v_n_f, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_initial_len, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_initial_len, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GIVEREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_v_self->f_index);
__Pyx_DECREF(((PyObject *)__pyx_v_self->f_index));
__pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":295
+ /* "cdec/sa/bilex.pxi":302
* n_f = len(fcount)
* self.f_index = IntList(initial_len=n_f+1)
* for i from 0 <= i < n_f: # <<<<<<<<<<<<<<
* self.f_index.arr[i] = N
* N = N + fcount.arr[i]
*/
- __pyx_t_19 = __Pyx_PyInt_As_long(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_19 = __Pyx_PyInt_As_long(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20++) {
- __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_t_20); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_t_20); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":296
+ /* "cdec/sa/bilex.pxi":303
* self.f_index = IntList(initial_len=n_f+1)
* for i from 0 <= i < n_f:
* self.f_index.arr[i] = N # <<<<<<<<<<<<<<
* N = N + fcount.arr[i]
* fcount.arr[i] = 0
*/
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_N); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_21;
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_N); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ (__pyx_v_self->f_index->arr[__pyx_t_10]) = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297
+ /* "cdec/sa/bilex.pxi":304
* for i from 0 <= i < n_f:
* self.f_index.arr[i] = N
* N = N + fcount.arr[i] # <<<<<<<<<<<<<<
* fcount.arr[i] = 0
* self.f_index.arr[n_f] = N
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_12 = __Pyx_PyInt_From_int((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_int((__pyx_v_fcount->arr[__pyx_t_10])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __pyx_t_1 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = PyNumber_Add(__pyx_v_N, __pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298
+ /* "cdec/sa/bilex.pxi":305
* self.f_index.arr[i] = N
* N = N + fcount.arr[i]
* fcount.arr[i] = 0 # <<<<<<<<<<<<<<
* self.f_index.arr[n_f] = N
* self.e_index = IntList(initial_len=N)
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- (__pyx_v_fcount->arr[__pyx_t_8]) = 0;
- __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_i); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ (__pyx_v_fcount->arr[__pyx_t_10]) = 0;
+ __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_i); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":295
+ /* "cdec/sa/bilex.pxi":302
* n_f = len(fcount)
* self.f_index = IntList(initial_len=n_f+1)
* for i from 0 <= i < n_f: # <<<<<<<<<<<<<<
* self.f_index.arr[i] = N
* N = N + fcount.arr[i]
*/
- __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_20); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299
+ /* "cdec/sa/bilex.pxi":306
* N = N + fcount.arr[i]
* fcount.arr[i] = 0
* self.f_index.arr[n_f] = N # <<<<<<<<<<<<<<
* self.e_index = IntList(initial_len=N)
* self.col1 = FloatList(initial_len=N)
*/
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_N); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_21;
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_N); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n_f); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ (__pyx_v_self->f_index->arr[__pyx_t_10]) = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300
+ /* "cdec/sa/bilex.pxi":307
* fcount.arr[i] = 0
* self.f_index.arr[n_f] = N
* self.e_index = IntList(initial_len=N) # <<<<<<<<<<<<<<
* self.col1 = FloatList(initial_len=N)
* self.col2 = FloatList(initial_len=N)
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GIVEREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_v_self->e_index);
__Pyx_DECREF(((PyObject *)__pyx_v_self->e_index));
__pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301
+ /* "cdec/sa/bilex.pxi":308
* self.f_index.arr[n_f] = N
* self.e_index = IntList(initial_len=N)
* self.col1 = FloatList(initial_len=N) # <<<<<<<<<<<<<<
* self.col2 = FloatList(initial_len=N)
*
*/
- __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_v_self->col1);
__Pyx_DECREF(((PyObject *)__pyx_v_self->col1));
- __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302
+ /* "cdec/sa/bilex.pxi":309
* self.e_index = IntList(initial_len=N)
* self.col1 = FloatList(initial_len=N)
* self.col2 = FloatList(initial_len=N) # <<<<<<<<<<<<<<
*
* # Re-read file, placing words into buckets
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_initial_len, __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GIVEREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_v_self->col2);
__Pyx_DECREF(((PyObject *)__pyx_v_self->col2));
__pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305
+ /* "cdec/sa/bilex.pxi":312
*
* # Re-read file, placing words into buckets
* f.seek(0) # <<<<<<<<<<<<<<
* for line in f:
* (fword, eword, score1, score2) = line.split()
*/
- __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_seek); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_12);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306
+ /* "cdec/sa/bilex.pxi":313
* # Re-read file, placing words into buckets
* f.seek(0)
* for line in f: # <<<<<<<<<<<<<<
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword)
*/
- if (PyList_CheckExact(__pyx_v_f) || PyTuple_CheckExact(__pyx_v_f)) {
- __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_f)) || PyTuple_CheckExact(__pyx_v_f)) {
+ __pyx_t_5 = __pyx_v_f; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
+ __pyx_t_11 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_12 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_12); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_12 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_11)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_12 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_12 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_12 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_12 = __pyx_t_9(__pyx_t_1);
+ __pyx_t_12 = __pyx_t_11(__pyx_t_5);
if (unlikely(!__pyx_t_12)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -17642,20 +18643,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
__Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_12);
__pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":307
+ /* "cdec/sa/bilex.pxi":314
* f.seek(0)
* for line in f:
* (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<<
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword)
*/
- __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ }
__Pyx_GOTREF(__pyx_t_12);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
+ PyObject* sequence = __pyx_t_12;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -17664,191 +18680,231 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
if (unlikely(size != 4)) {
if (size > 4) __Pyx_RaiseTooManyValuesError(4);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 3);
} else {
- __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_10 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
__pyx_t_2 = PyList_GET_ITEM(sequence, 3);
}
- __Pyx_INCREF(__pyx_t_12);
- __Pyx_INCREF(__pyx_t_11);
- __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
#else
{
Py_ssize_t i;
- PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2};
+ PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_3,&__pyx_t_2};
for (i=0; i < 4; i++) {
- PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_2};
- __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_3,&__pyx_t_2};
+ __pyx_t_13 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
for (index=0; index < 4; index++) {
- PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L26_unpacking_failed;
+ PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L25_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_14 = NULL;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- goto __pyx_L27_unpacking_done;
- __pyx_L26_unpacking_failed:;
+ goto __pyx_L26_unpacking_done;
+ __pyx_L25_unpacking_failed:;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_14 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L27_unpacking_done:;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_L26_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_fword, __pyx_t_12);
- __pyx_t_12 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_11);
- __pyx_t_11 = 0;
- __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_fword, __pyx_t_1);
+ __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eword, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":308
+ /* "cdec/sa/bilex.pxi":315
* for line in f:
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword) # <<<<<<<<<<<<<<
* e_id = self.get_e_id(eword)
* index = self.f_index.arr[f_id] + fcount.arr[f_id]
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_f_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_f_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_fword);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fword);
- __Pyx_GIVEREF(__pyx_v_fword);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fword); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_v_fword);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fword);
+ __Pyx_GIVEREF(__pyx_v_fword);
+ __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_f_id, __pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309
+ /* "cdec/sa/bilex.pxi":316
* (fword, eword, score1, score2) = line.split()
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword) # <<<<<<<<<<<<<<
* index = self.f_index.arr[f_id] + fcount.arr[f_id]
* fcount.arr[f_id] = fcount.arr[f_id] + 1
*/
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_e_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_e_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_eword);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_eword);
- __Pyx_GIVEREF(__pyx_v_eword);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_eword); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_eword);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_eword);
+ __Pyx_GIVEREF(__pyx_v_eword);
+ __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310
+ /* "cdec/sa/bilex.pxi":317
* f_id = self.get_f_id(fword)
* e_id = self.get_e_id(eword)
* index = self.f_index.arr[f_id] + fcount.arr[f_id] # <<<<<<<<<<<<<<
* fcount.arr[f_id] = fcount.arr[f_id] + 1
* self.e_index.arr[index] = int(e_id)
*/
- __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_3 = __Pyx_PyInt_From_int(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_18]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_int(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_18]))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311
+ /* "cdec/sa/bilex.pxi":318
* e_id = self.get_e_id(eword)
* index = self.f_index.arr[f_id] + fcount.arr[f_id]
* fcount.arr[f_id] = fcount.arr[f_id] + 1 # <<<<<<<<<<<<<<
* self.e_index.arr[index] = int(e_id)
* self.col1[index] = float(score1)
*/
- __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
(__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_18]) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312
+ /* "cdec/sa/bilex.pxi":319
* index = self.f_index.arr[f_id] + fcount.arr[f_id]
* fcount.arr[f_id] = fcount.arr[f_id] + 1
* self.e_index.arr[index] = int(e_id) # <<<<<<<<<<<<<<
* self.col1[index] = float(score1)
* self.col2[index] = float(score2)
*/
- __pyx_t_3 = PyNumber_Int(__pyx_v_e_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyNumber_Int(__pyx_v_e_id); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
(__pyx_v_self->e_index->arr[__pyx_t_18]) = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":313
+ /* "cdec/sa/bilex.pxi":320
* fcount.arr[f_id] = fcount.arr[f_id] + 1
* self.e_index.arr[index] = int(e_id)
* self.col1[index] = float(score1) # <<<<<<<<<<<<<<
* self.col2[index] = float(score2)
*
*/
- __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_22 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_3 = PyFloat_FromDouble(__pyx_t_22); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_22 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyFloat_FromDouble(__pyx_t_22); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_12) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":314
+ /* "cdec/sa/bilex.pxi":321
* self.e_index.arr[index] = int(e_id)
* self.col1[index] = float(score1)
* self.col2[index] = float(score2) # <<<<<<<<<<<<<<
*
* # Sort buckets by eword
*/
- __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_22 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_3 = PyFloat_FromDouble(__pyx_t_22); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_3) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_22 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_22 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = PyFloat_FromDouble(__pyx_t_22); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_12) < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+
+ /* "cdec/sa/bilex.pxi":313
+ * # Re-read file, placing words into buckets
+ * f.seek(0)
+ * for line in f: # <<<<<<<<<<<<<<
+ * (fword, eword, score1, score2) = line.split()
+ * f_id = self.get_f_id(fword)
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
+ /* "cdec/sa/bilex.pxi":288
*
* fcount = IntList()
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
@@ -17857,140 +18913,140 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_GOTREF(__pyx_t_3);
+ if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_12, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_3 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_23);
__pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_23);
__Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
- if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__pyx_t_24 = ((!(__pyx_t_16 != 0)) != 0);
if (__pyx_t_24) {
- __Pyx_GIVEREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_2);
- __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_2);
- __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_ErrRestore(__pyx_t_5, __pyx_t_12, __pyx_t_2);
+ __pyx_t_5 = 0; __pyx_t_12 = 0; __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
- __Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
- if (__pyx_t_4) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__31, NULL);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_6) {
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__31, NULL);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L31;
+ goto __pyx_L30;
__pyx_L3_error:;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L1_error;
- __pyx_L31:;
+ __pyx_L30:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":317
+ /* "cdec/sa/bilex.pxi":324
*
* # Sort buckets by eword
* for b from 0 <= b < n_f: # <<<<<<<<<<<<<<
* i = self.f_index.arr[b]
* j = self.f_index.arr[b+1]
*/
- if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_n_f); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_v_n_f)) { __Pyx_RaiseUnboundLocalError("n_f"); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_20 = __Pyx_PyInt_As_long(__pyx_v_n_f); if (unlikely((__pyx_t_20 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_20; __pyx_t_19++) {
- __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":318
+ /* "cdec/sa/bilex.pxi":325
* # Sort buckets by eword
* for b from 0 <= b < n_f:
* i = self.f_index.arr[b] # <<<<<<<<<<<<<<
* j = self.f_index.arr[b+1]
* self.qsort(i,j, "")
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_b); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_b); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_10])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319
+ /* "cdec/sa/bilex.pxi":326
* for b from 0 <= b < n_f:
* i = self.f_index.arr[b]
* j = self.f_index.arr[b+1] # <<<<<<<<<<<<<<
* self.qsort(i,j, "")
*
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_10])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320
+ /* "cdec/sa/bilex.pxi":327
* i = self.f_index.arr[b]
* j = self.f_index.arr[b+1]
* self.qsort(i,j, "") # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_v_j); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_21, __pyx_t_25, __pyx_kp_s__32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_v_j); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_21, __pyx_t_25, __pyx_kp_s__32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_19 = __Pyx_PyInt_As_long(__pyx_v_b); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_19 = __Pyx_PyInt_As_long(__pyx_v_b); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":317
+ /* "cdec/sa/bilex.pxi":324
*
* # Sort buckets by eword
* for b from 0 <= b < n_f: # <<<<<<<<<<<<<<
* i = self.f_index.arr[b]
* j = self.f_index.arr[b+1]
*/
- __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276
+ /* "cdec/sa/bilex.pxi":283
*
*
* def read_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -18005,8 +19061,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_10);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
@@ -18032,7 +19088,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14read_text(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323
+/* "cdec/sa/bilex.pxi":330
*
*
* cdef swap(self, int i, int j): # <<<<<<<<<<<<<<
@@ -18048,7 +19104,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
int __pyx_t_1;
__Pyx_RefNannySetupContext("swap", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327
+ /* "cdec/sa/bilex.pxi":334
* cdef float ftmp
*
* if i == j: # <<<<<<<<<<<<<<
@@ -18058,7 +19114,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
__pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328
+ /* "cdec/sa/bilex.pxi":335
*
* if i == j:
* return # <<<<<<<<<<<<<<
@@ -18070,7 +19126,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330
+ /* "cdec/sa/bilex.pxi":337
* return
*
* itmp = self.e_index.arr[i] # <<<<<<<<<<<<<<
@@ -18079,7 +19135,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331
+ /* "cdec/sa/bilex.pxi":338
*
* itmp = self.e_index.arr[i]
* self.e_index.arr[i] = self.e_index.arr[j] # <<<<<<<<<<<<<<
@@ -18088,7 +19144,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332
+ /* "cdec/sa/bilex.pxi":339
* itmp = self.e_index.arr[i]
* self.e_index.arr[i] = self.e_index.arr[j]
* self.e_index.arr[j] = itmp # <<<<<<<<<<<<<<
@@ -18097,7 +19153,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":334
+ /* "cdec/sa/bilex.pxi":341
* self.e_index.arr[j] = itmp
*
* ftmp = self.col1.arr[i] # <<<<<<<<<<<<<<
@@ -18106,7 +19162,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335
+ /* "cdec/sa/bilex.pxi":342
*
* ftmp = self.col1.arr[i]
* self.col1.arr[i] = self.col1.arr[j] # <<<<<<<<<<<<<<
@@ -18115,7 +19171,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":336
+ /* "cdec/sa/bilex.pxi":343
* ftmp = self.col1.arr[i]
* self.col1.arr[i] = self.col1.arr[j]
* self.col1.arr[j] = ftmp # <<<<<<<<<<<<<<
@@ -18124,7 +19180,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338
+ /* "cdec/sa/bilex.pxi":345
* self.col1.arr[j] = ftmp
*
* ftmp = self.col2.arr[i] # <<<<<<<<<<<<<<
@@ -18133,7 +19189,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339
+ /* "cdec/sa/bilex.pxi":346
*
* ftmp = self.col2.arr[i]
* self.col2.arr[i] = self.col2.arr[j] # <<<<<<<<<<<<<<
@@ -18142,7 +19198,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340
+ /* "cdec/sa/bilex.pxi":347
* ftmp = self.col2.arr[i]
* self.col2.arr[i] = self.col2.arr[j]
* self.col2.arr[j] = ftmp # <<<<<<<<<<<<<<
@@ -18151,7 +19207,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
*/
(__pyx_v_self->col2->arr[__pyx_v_j]) = __pyx_v_ftmp;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323
+ /* "cdec/sa/bilex.pxi":330
*
*
* cdef swap(self, int i, int j): # <<<<<<<<<<<<<<
@@ -18167,7 +19223,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_swap(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343
+/* "cdec/sa/bilex.pxi":350
*
*
* cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<<
@@ -18190,7 +19246,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("qsort", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346
+ /* "cdec/sa/bilex.pxi":353
* cdef int pval, p
*
* if i > j: # <<<<<<<<<<<<<<
@@ -18200,21 +19256,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_i > __pyx_v_j) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347
+ /* "cdec/sa/bilex.pxi":354
*
* if i > j:
* raise Exception("Sort error in CLex") # <<<<<<<<<<<<<<
* if i == j: #empty interval
* return
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348
+ /* "cdec/sa/bilex.pxi":355
* if i > j:
* raise Exception("Sort error in CLex")
* if i == j: #empty interval # <<<<<<<<<<<<<<
@@ -18224,7 +19280,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349
+ /* "cdec/sa/bilex.pxi":356
* raise Exception("Sort error in CLex")
* if i == j: #empty interval
* return # <<<<<<<<<<<<<<
@@ -18236,7 +19292,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350
+ /* "cdec/sa/bilex.pxi":357
* if i == j: #empty interval
* return
* if i == j-1: # singleton interval # <<<<<<<<<<<<<<
@@ -18246,7 +19302,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_i == (__pyx_v_j - 1)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351
+ /* "cdec/sa/bilex.pxi":358
* return
* if i == j-1: # singleton interval
* return # <<<<<<<<<<<<<<
@@ -18258,7 +19314,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353
+ /* "cdec/sa/bilex.pxi":360
* return
*
* p = (i+j)/2 # <<<<<<<<<<<<<<
@@ -18267,7 +19323,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354
+ /* "cdec/sa/bilex.pxi":361
*
* p = (i+j)/2
* pval = self.e_index.arr[p] # <<<<<<<<<<<<<<
@@ -18276,18 +19332,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355
+ /* "cdec/sa/bilex.pxi":362
* p = (i+j)/2
* pval = self.e_index.arr[p]
* self.swap(i, p) # <<<<<<<<<<<<<<
* p = i
* for k from i+1 <= k < j:
*/
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_i, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_i, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":356
+ /* "cdec/sa/bilex.pxi":363
* pval = self.e_index.arr[p]
* self.swap(i, p)
* p = i # <<<<<<<<<<<<<<
@@ -18296,7 +19352,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_p = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":357
+ /* "cdec/sa/bilex.pxi":364
* self.swap(i, p)
* p = i
* for k from i+1 <= k < j: # <<<<<<<<<<<<<<
@@ -18306,7 +19362,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_t_3 = __pyx_v_j;
for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358
+ /* "cdec/sa/bilex.pxi":365
* p = i
* for k from i+1 <= k < j:
* if pval >= self.e_index.arr[k]: # <<<<<<<<<<<<<<
@@ -18316,29 +19372,29 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359
+ /* "cdec/sa/bilex.pxi":366
* for k from i+1 <= k < j:
* if pval >= self.e_index.arr[k]:
* self.swap(p+1, k) # <<<<<<<<<<<<<<
* self.swap(p, p+1)
* p = p + 1
*/
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360
+ /* "cdec/sa/bilex.pxi":367
* if pval >= self.e_index.arr[k]:
* self.swap(p+1, k)
* self.swap(p, p+1) # <<<<<<<<<<<<<<
* p = p + 1
* self.qsort(i,p, pad+" ")
*/
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_p, (__pyx_v_p + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->swap(__pyx_v_self, __pyx_v_p, (__pyx_v_p + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361
+ /* "cdec/sa/bilex.pxi":368
* self.swap(p+1, k)
* self.swap(p, p+1)
* p = p + 1 # <<<<<<<<<<<<<<
@@ -18351,35 +19407,35 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
__pyx_L8:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362
+ /* "cdec/sa/bilex.pxi":369
* self.swap(p, p+1)
* p = p + 1
* self.qsort(i,p, pad+" ") # <<<<<<<<<<<<<<
* self.qsort(p+1,j, pad+" ")
*
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_v_i, __pyx_v_p, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_v_i, __pyx_v_p, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363
+ /* "cdec/sa/bilex.pxi":370
* p = p + 1
* self.qsort(i,p, pad+" ")
* self.qsort(p+1,j, pad+" ") # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_j, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, (__pyx_v_p + 1), __pyx_v_j, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343
+ /* "cdec/sa/bilex.pxi":350
*
*
* cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<<
@@ -18401,7 +19457,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort(struct __pyx_obj_4cdec_2sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366
+/* "cdec/sa/bilex.pxi":373
*
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -18420,7 +19476,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced(PyObject *__pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_enhanced (wrapper)", 0);
assert(__pyx_arg_filename); {
- __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -18450,21 +19506,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
PyObject *(*__pyx_t_13)(PyObject *);
PyObject *__pyx_t_14 = NULL;
- int __pyx_t_15;
+ PyObject *__pyx_t_15 = NULL;
int __pyx_t_16;
+ int __pyx_t_17;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_enhanced", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
+ /* "cdec/sa/bilex.pxi":374
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -18472,9 +19529,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
* f.write("%d " % i)
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -18482,65 +19539,83 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w);
__Pyx_GIVEREF(__pyx_n_s_w);
__pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368
+ /* "cdec/sa/bilex.pxi":375
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f:
* for i in self.f_index: # <<<<<<<<<<<<<<
* f.write("%d " % i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->f_index)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->f_index))) {
- __pyx_t_4 = ((PyObject *)__pyx_v_self->f_index); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->f_index))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->f_index))) {
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->f_index); __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->f_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->f_index)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_9(__pyx_t_4);
+ __pyx_t_1 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -18549,96 +19624,123 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369
+ /* "cdec/sa/bilex.pxi":376
* with open(filename, "w") as f:
* for i in self.f_index:
* f.write("%d " % i) # <<<<<<<<<<<<<<
* f.write("\n")
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "cdec/sa/bilex.pxi":375
+ * def write_enhanced(self, char* filename):
+ * with open(filename, "w") as f:
+ * for i in self.f_index: # <<<<<<<<<<<<<<
+ * f.write("%d " % i)
+ * f.write("\n")
+ */
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370
+ /* "cdec/sa/bilex.pxi":377
* for i in self.f_index:
* f.write("%d " % i)
* f.write("\n") # <<<<<<<<<<<<<<
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
* f.write("%d %f %f " % (i, s1, s2))
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371
+ /* "cdec/sa/bilex.pxi":378
* f.write("%d " % i)
* f.write("\n")
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2): # <<<<<<<<<<<<<<
* f.write("%d %f %f " % (i, s1, s2))
* f.write("\n")
*/
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_self->e_index));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->e_index));
+ PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->e_index));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->e_index));
__Pyx_INCREF(((PyObject *)__pyx_v_self->col1));
- PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->col1));
+ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->col1));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->col1));
__Pyx_INCREF(((PyObject *)__pyx_v_self->col2));
- PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->col2));
+ PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_self->col2));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->col2));
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_9(__pyx_t_2);
+ __pyx_t_4 = __pyx_t_10(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
@@ -18654,111 +19756,136 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
} else {
- __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_5 = PyList_GET_ITEM(sequence, 2);
}
- __Pyx_INCREF(__pyx_t_10);
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(__pyx_t_5);
#else
- __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
- index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_10);
- index = 1; __pyx_t_1 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_1);
- index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L20_unpacking_failed;
+ __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_13 = Py_TYPE(__pyx_t_11)->tp_iternext;
+ index = 0; __pyx_t_2 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L19_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_2);
+ index = 1; __pyx_t_12 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L19_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ index = 2; __pyx_t_5 = __pyx_t_13(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L19_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__pyx_t_13 = NULL;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- goto __pyx_L21_unpacking_done;
- __pyx_L20_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ goto __pyx_L20_unpacking_done;
+ __pyx_L19_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_13 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_L21_unpacking_done:;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_L20_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_10);
- __pyx_t_10 = 0;
- __Pyx_XDECREF_SET(__pyx_v_s1, __pyx_t_1);
- __pyx_t_1 = 0;
- __Pyx_XDECREF_SET(__pyx_v_s2, __pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
+ __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_s1, __pyx_t_12);
+ __pyx_t_12 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_s2, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":372
+ /* "cdec/sa/bilex.pxi":379
* f.write("\n")
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
* f.write("%d %f %f " % (i, s1, s2)) # <<<<<<<<<<<<<<
* f.write("\n")
* for i, w in enumerate(self.id2fword):
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
__Pyx_INCREF(__pyx_v_i);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_i);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_s1);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_s1);
+ PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_s1);
__Pyx_GIVEREF(__pyx_v_s1);
__Pyx_INCREF(__pyx_v_s2);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_s2);
+ PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_s2);
__Pyx_GIVEREF(__pyx_v_s2);
- __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_d_f_f, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d_f_f, __pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_12) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "cdec/sa/bilex.pxi":378
+ * f.write("%d " % i)
+ * f.write("\n")
+ * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): # <<<<<<<<<<<<<<
+ * f.write("%d %f %f " % (i, s1, s2))
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":373
+ /* "cdec/sa/bilex.pxi":380
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
* f.write("%d %f %f " % (i, s1, s2))
* f.write("\n") # <<<<<<<<<<<<<<
* for i, w in enumerate(self.id2fword):
* f.write("%d %s " % (i, w))
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374
+ /* "cdec/sa/bilex.pxi":381
* f.write("%d %f %f " % (i, s1, s2))
* f.write("\n")
* for i, w in enumerate(self.id2fword): # <<<<<<<<<<<<<<
@@ -18766,101 +19893,128 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
* f.write("\n")
*/
__Pyx_INCREF(__pyx_int_0);
- __pyx_t_1 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_self->id2fword) || PyTuple_CheckExact(__pyx_v_self->id2fword)) {
- __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __pyx_t_4 = __pyx_int_0;
+ if (likely(PyList_CheckExact(__pyx_v_self->id2fword)) || PyTuple_CheckExact(__pyx_v_self->id2fword)) {
+ __pyx_t_1 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->id2fword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_11 = __pyx_t_9(__pyx_t_2);
- if (unlikely(!__pyx_t_11)) {
+ __pyx_t_5 = __pyx_t_10(__pyx_t_1);
+ if (unlikely(!__pyx_t_5)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GOTREF(__pyx_t_5);
}
- __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_11);
- __pyx_t_11 = 0;
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_1);
- __pyx_t_1 = __pyx_t_11;
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
+ __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4);
+ __pyx_t_4 = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":375
+ /* "cdec/sa/bilex.pxi":382
* f.write("\n")
* for i, w in enumerate(self.id2fword):
* f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<<
* f.write("\n")
* for i, w in enumerate(self.id2eword):
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_i);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_w);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_w);
__Pyx_GIVEREF(__pyx_v_w);
- __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_d_s, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d_s, __pyx_t_2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_11);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_11, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ }
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "cdec/sa/bilex.pxi":381
+ * f.write("%d %f %f " % (i, s1, s2))
+ * f.write("\n")
+ * for i, w in enumerate(self.id2fword): # <<<<<<<<<<<<<<
+ * f.write("%d %s " % (i, w))
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":376
+ /* "cdec/sa/bilex.pxi":383
* for i, w in enumerate(self.id2fword):
* f.write("%d %s " % (i, w))
* f.write("\n") # <<<<<<<<<<<<<<
* for i, w in enumerate(self.id2eword):
* f.write("%d %s " % (i, w))
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377
+ /* "cdec/sa/bilex.pxi":384
* f.write("%d %s " % (i, w))
* f.write("\n")
* for i, w in enumerate(self.id2eword): # <<<<<<<<<<<<<<
@@ -18868,113 +20022,141 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
* f.write("\n")
*/
__Pyx_INCREF(__pyx_int_0);
- __pyx_t_2 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_self->id2eword) || PyTuple_CheckExact(__pyx_v_self->id2eword)) {
- __pyx_t_1 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ __pyx_t_1 = __pyx_int_0;
+ if (likely(PyList_CheckExact(__pyx_v_self->id2eword)) || PyTuple_CheckExact(__pyx_v_self->id2eword)) {
+ __pyx_t_4 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->id2eword); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_10 = __pyx_t_9(__pyx_t_1);
- if (unlikely(!__pyx_t_10)) {
+ __pyx_t_5 = __pyx_t_10(__pyx_t_4);
+ if (unlikely(!__pyx_t_5)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_GOTREF(__pyx_t_5);
}
- __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_10);
- __pyx_t_10 = 0;
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_2);
- __pyx_t_2 = __pyx_t_10;
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
+ __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_1 = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378
+ /* "cdec/sa/bilex.pxi":385
* f.write("\n")
* for i, w in enumerate(self.id2eword):
* f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(__pyx_v_i);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_w);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w);
+ PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_w);
__Pyx_GIVEREF(__pyx_v_w);
- __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_d_s, __pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d_s, __pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_11);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_11, function);
+ }
+ }
+ if (!__pyx_t_14) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+ /* "cdec/sa/bilex.pxi":384
+ * f.write("%d %s " % (i, w))
+ * f.write("\n")
+ * for i, w in enumerate(self.id2eword): # <<<<<<<<<<<<<<
+ * f.write("%d %s " % (i, w))
+ * f.write("\n")
+ */
}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379
+ /* "cdec/sa/bilex.pxi":386
* for i, w in enumerate(self.id2eword):
* f.write("%d %s " % (i, w))
* f.write("\n") # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
+ __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
+ /* "cdec/sa/bilex.pxi":374
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -18983,69 +20165,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_4 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (__pyx_t_15 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_16 = ((!(__pyx_t_15 != 0)) != 0);
- if (__pyx_t_16) {
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_17 = ((!(__pyx_t_16 != 0)) != 0);
+ if (__pyx_t_17) {
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_XGIVEREF(__pyx_t_11);
- __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_11);
- __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_11 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_5);
+ __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__39, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__39, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L29;
+ goto __pyx_L28;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L29:;
+ __pyx_L28:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366
+ /* "cdec/sa/bilex.pxi":373
*
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -19060,9 +20242,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_14);
__Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -19076,7 +20259,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_enhanced(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382
+/* "cdec/sa/bilex.pxi":389
*
*
* def get_score(self, fword, eword, col): # <<<<<<<<<<<<<<
@@ -19117,16 +20300,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score(PyObject *__pyx_v_se
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_eword)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 1); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, 2); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_score") < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -19141,7 +20324,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score(PyObject *__pyx_v_se
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -19173,18 +20356,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_score", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385
+ /* "cdec/sa/bilex.pxi":392
* cdef e_id, f_id, low, high, midpoint, val
*
* if eword not in self.eword2id: # <<<<<<<<<<<<<<
* return None
* if fword not in self.fword2id:
*/
- __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_eword, __pyx_v_self->eword2id, Py_NE)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386
+ /* "cdec/sa/bilex.pxi":393
*
* if eword not in self.eword2id:
* return None # <<<<<<<<<<<<<<
@@ -19197,18 +20380,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387
+ /* "cdec/sa/bilex.pxi":394
* if eword not in self.eword2id:
* return None
* if fword not in self.fword2id: # <<<<<<<<<<<<<<
* return None
* f_id = self.fword2id[fword]
*/
- __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_fword, __pyx_v_self->fword2id, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388
+ /* "cdec/sa/bilex.pxi":395
* return None
* if fword not in self.fword2id:
* return None # <<<<<<<<<<<<<<
@@ -19221,60 +20404,60 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389
+ /* "cdec/sa/bilex.pxi":396
* if fword not in self.fword2id:
* return None
* f_id = self.fword2id[fword] # <<<<<<<<<<<<<<
* e_id = self.eword2id[eword]
* low = self.f_index.arr[f_id]
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_f_id = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390
+ /* "cdec/sa/bilex.pxi":397
* return None
* f_id = self.fword2id[fword]
* e_id = self.eword2id[eword] # <<<<<<<<<<<<<<
* low = self.f_index.arr[f_id]
* high = self.f_index.arr[f_id+1]
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_e_id = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391
+ /* "cdec/sa/bilex.pxi":398
* f_id = self.fword2id[fword]
* e_id = self.eword2id[eword]
* low = self.f_index.arr[f_id] # <<<<<<<<<<<<<<
* high = self.f_index.arr[f_id+1]
* while high - low > 0:
*/
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_low = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392
+ /* "cdec/sa/bilex.pxi":399
* e_id = self.eword2id[eword]
* low = self.f_index.arr[f_id]
* high = self.f_index.arr[f_id+1] # <<<<<<<<<<<<<<
* while high - low > 0:
* midpoint = (low+high)/2
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_high = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393
+ /* "cdec/sa/bilex.pxi":400
* low = self.f_index.arr[f_id]
* high = self.f_index.arr[f_id+1]
* while high - low > 0: # <<<<<<<<<<<<<<
@@ -19282,67 +20465,67 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
* val = self.e_index.arr[midpoint]
*/
while (1) {
- __pyx_t_3 = PyNumber_Subtract(__pyx_v_high, __pyx_v_low); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Subtract(__pyx_v_high, __pyx_v_low); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394
+ /* "cdec/sa/bilex.pxi":401
* high = self.f_index.arr[f_id+1]
* while high - low > 0:
* midpoint = (low+high)/2 # <<<<<<<<<<<<<<
* val = self.e_index.arr[midpoint]
* if val == e_id:
*/
- __pyx_t_5 = PyNumber_Add(__pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Add(__pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF_SET(__pyx_v_midpoint, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395
+ /* "cdec/sa/bilex.pxi":402
* while high - low > 0:
* midpoint = (low+high)/2
* val = self.e_index.arr[midpoint] # <<<<<<<<<<<<<<
* if val == e_id:
* if col == 0:
*/
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396
+ /* "cdec/sa/bilex.pxi":403
* midpoint = (low+high)/2
* val = self.e_index.arr[midpoint]
* if val == e_id: # <<<<<<<<<<<<<<
* if col == 0:
* return self.col1.arr[midpoint]
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397
+ /* "cdec/sa/bilex.pxi":404
* val = self.e_index.arr[midpoint]
* if val == e_id:
* if col == 0: # <<<<<<<<<<<<<<
* return self.col1.arr[midpoint]
* if col == 1:
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":398
+ /* "cdec/sa/bilex.pxi":405
* if val == e_id:
* if col == 0:
* return self.col1.arr[midpoint] # <<<<<<<<<<<<<<
@@ -19350,27 +20533,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
* return self.col2.arr[midpoint]
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":399
+ /* "cdec/sa/bilex.pxi":406
* if col == 0:
* return self.col1.arr[midpoint]
* if col == 1: # <<<<<<<<<<<<<<
* return self.col2.arr[midpoint]
* if val > e_id:
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_col, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400
+ /* "cdec/sa/bilex.pxi":407
* return self.col1.arr[midpoint]
* if col == 1:
* return self.col2.arr[midpoint] # <<<<<<<<<<<<<<
@@ -19378,8 +20561,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
* high = midpoint
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_midpoint); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -19389,19 +20572,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
}
__pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":401
+ /* "cdec/sa/bilex.pxi":408
* if col == 1:
* return self.col2.arr[midpoint]
* if val > e_id: # <<<<<<<<<<<<<<
* high = midpoint
* if val < e_id:
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":402
+ /* "cdec/sa/bilex.pxi":409
* return self.col2.arr[midpoint]
* if val > e_id:
* high = midpoint # <<<<<<<<<<<<<<
@@ -19414,26 +20597,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
}
__pyx_L10:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":403
+ /* "cdec/sa/bilex.pxi":410
* if val > e_id:
* high = midpoint
* if val < e_id: # <<<<<<<<<<<<<<
* low = midpoint + 1
* return None
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_e_id, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404
+ /* "cdec/sa/bilex.pxi":411
* high = midpoint
* if val < e_id:
* low = midpoint + 1 # <<<<<<<<<<<<<<
* return None
*
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_midpoint, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_midpoint, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_low, __pyx_t_3);
__pyx_t_3 = 0;
@@ -19442,7 +20625,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
__pyx_L11:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405
+ /* "cdec/sa/bilex.pxi":412
* if val < e_id:
* low = midpoint + 1
* return None # <<<<<<<<<<<<<<
@@ -19454,7 +20637,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
__pyx_r = Py_None;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382
+ /* "cdec/sa/bilex.pxi":389
*
*
* def get_score(self, fword, eword, col): # <<<<<<<<<<<<<<
@@ -19480,7 +20663,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_18get_score(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408
+/* "cdec/sa/bilex.pxi":415
*
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -19500,7 +20683,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text(PyObject *__pyx_v_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_text (wrapper)", 0);
assert(__pyx_arg_filename); {
- __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_filename = __Pyx_PyObject_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -19532,19 +20715,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- long __pyx_t_9;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
long __pyx_t_10;
- int __pyx_t_11;
- PyObject *__pyx_t_12 = NULL;
+ long __pyx_t_11;
+ int __pyx_t_12;
PyObject *__pyx_t_13 = NULL;
- int __pyx_t_14;
+ PyObject *__pyx_t_14 = NULL;
+ int __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
+ /* "cdec/sa/bilex.pxi":419
* cdef i, N, e_id, f_id
*
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -19552,9 +20736,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
* f_id = 0
*/
/*with:*/ {
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -19562,29 +20746,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_w);
__Pyx_GIVEREF(__pyx_n_s_w);
__pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413
+ /* "cdec/sa/bilex.pxi":420
*
* with open(filename, "w") as f:
* N = len(self.e_index) # <<<<<<<<<<<<<<
@@ -19593,14 +20793,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
*/
__pyx_t_4 = ((PyObject *)__pyx_v_self->e_index);
__Pyx_INCREF(__pyx_t_4);
- __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_N = __pyx_t_4;
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":414
+ /* "cdec/sa/bilex.pxi":421
* with open(filename, "w") as f:
* N = len(self.e_index)
* f_id = 0 # <<<<<<<<<<<<<<
@@ -19610,21 +20810,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
__Pyx_INCREF(__pyx_int_0);
__pyx_v_f_id = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":415
+ /* "cdec/sa/bilex.pxi":422
* N = len(self.e_index)
* f_id = 0
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
* while self.f_index.arr[f_id+1] == i:
* f_id = f_id + 1
*/
- __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++) {
- __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_N); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
+ __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":416
+ /* "cdec/sa/bilex.pxi":423
* f_id = 0
* for i from 0 <= i < N:
* while self.f_index.arr[f_id+1] == i: # <<<<<<<<<<<<<<
@@ -19632,133 +20832,151 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
* e_id = self.e_index.arr[i]
*/
while (1) {
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_self->f_index->arr[__pyx_t_9])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (!__pyx_t_11) break;
+ if (!__pyx_t_12) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":417
+ /* "cdec/sa/bilex.pxi":424
* for i from 0 <= i < N:
* while self.f_index.arr[f_id+1] == i:
* f_id = f_id + 1 # <<<<<<<<<<<<<<
* e_id = self.e_index.arr[i]
* score1 = self.col1.arr[i]
*/
- __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_f_id, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_f_id, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":418
+ /* "cdec/sa/bilex.pxi":425
* while self.f_index.arr[f_id+1] == i:
* f_id = f_id + 1
* e_id = self.e_index.arr[i] # <<<<<<<<<<<<<<
* score1 = self.col1.arr[i]
* score2 = self.col2.arr[i]
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->e_index->arr[__pyx_t_9])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_e_id, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":419
+ /* "cdec/sa/bilex.pxi":426
* f_id = f_id + 1
* e_id = self.e_index.arr[i]
* score1 = self.col1.arr[i] # <<<<<<<<<<<<<<
* score2 = self.col2.arr[i]
* f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2))
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col1->arr[__pyx_t_9])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_score1, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":420
+ /* "cdec/sa/bilex.pxi":427
* e_id = self.e_index.arr[i]
* score1 = self.col1.arr[i]
* score2 = self.col2.arr[i] # <<<<<<<<<<<<<<
* f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2))
*/
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->col2->arr[__pyx_t_9])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_score2, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":421
+ /* "cdec/sa/bilex.pxi":428
* score1 = self.col1.arr[i]
* score2 = self.col2.arr[i]
* f.write("%s %s %.6f %.6f\n" % (self.id2fword[f_id], self.id2eword[e_id], score1, score2)) # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_GetItem(__pyx_v_self->id2fword, __pyx_v_f_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyObject_GetItem(__pyx_v_self->id2eword, __pyx_v_e_id); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->id2fword, __pyx_v_f_id); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2);
+ __pyx_t_5 = PyObject_GetItem(__pyx_v_self->id2eword, __pyx_v_e_id); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_score1);
- PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_score1);
+ PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_score1);
__Pyx_GIVEREF(__pyx_v_score1);
__Pyx_INCREF(__pyx_v_score2);
- PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_v_score2);
+ PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_v_score2);
__Pyx_GIVEREF(__pyx_v_score2);
- __pyx_t_4 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s_6f_6f, __pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_12);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_s_6f_6f, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_13 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_13)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_13);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_13) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_v_i); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":415
+ /* "cdec/sa/bilex.pxi":422
* N = len(self.e_index)
* f_id = 0
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
* while self.f_index.arr[f_id+1] == i:
* f_id = f_id + 1
*/
- __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
+ __pyx_t_1 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
+ __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
+ /* "cdec/sa/bilex.pxi":419
* cdef i, N, e_id, f_id
*
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -19767,69 +20985,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_12);
+ if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_12, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL);
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_13);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_14 = ((!(__pyx_t_11 != 0)) != 0);
- if (__pyx_t_14) {
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_12);
- __Pyx_XGIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_2, __pyx_t_12, __pyx_t_1);
- __pyx_t_2 = 0; __pyx_t_12 = 0; __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (__pyx_t_12 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_15 = ((!(__pyx_t_12 != 0)) != 0);
+ if (__pyx_t_15) {
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_ErrRestore(__pyx_t_1, __pyx_t_4, __pyx_t_2);
+ __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_2 = 0;
+ {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__40, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__40, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L23;
+ goto __pyx_L22;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408
+ /* "cdec/sa/bilex.pxi":415
*
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -19844,7 +21062,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -19860,7 +21079,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_20write_text(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":21
+/* "cdec/sa/veb.pxi":21
* cdef int LOWER_MASK[32]
*
* cdef void _init_lower_mask(): # <<<<<<<<<<<<<<
@@ -19876,7 +21095,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
unsigned int __pyx_t_2;
__Pyx_RefNannySetupContext("_init_lower_mask", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":23
+ /* "cdec/sa/veb.pxi":23
* cdef void _init_lower_mask():
* cdef unsigned i
* cdef int mask = 0 # <<<<<<<<<<<<<<
@@ -19885,7 +21104,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
*/
__pyx_v_mask = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":24
+ /* "cdec/sa/veb.pxi":24
* cdef unsigned i
* cdef int mask = 0
* for i in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<<
@@ -19896,7 +21115,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":25
+ /* "cdec/sa/veb.pxi":25
* cdef int mask = 0
* for i in range(MIN_BOTTOM_SIZE):
* mask = (mask << 1) + 1 # <<<<<<<<<<<<<<
@@ -19905,7 +21124,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
*/
__pyx_v_mask = ((__pyx_v_mask << 1) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":26
+ /* "cdec/sa/veb.pxi":26
* for i in range(MIN_BOTTOM_SIZE):
* mask = (mask << 1) + 1
* LOWER_MASK[i] = mask # <<<<<<<<<<<<<<
@@ -19915,7 +21134,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
(__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":21
+ /* "cdec/sa/veb.pxi":21
* cdef int LOWER_MASK[32]
*
* cdef void _init_lower_mask(): # <<<<<<<<<<<<<<
@@ -19927,7 +21146,7 @@ static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) {
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":37
+/* "cdec/sa/veb.pxi":37
*
*
* cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<<
@@ -19941,7 +21160,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("new_BitSet", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":40
+ /* "cdec/sa/veb.pxi":40
* cdef _BitSet* b
*
* b = <_BitSet*> malloc(sizeof(_BitSet)) # <<<<<<<<<<<<<<
@@ -19950,7 +21169,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
*/
__pyx_v_b = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__BitSet))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":41
+ /* "cdec/sa/veb.pxi":41
*
* b = <_BitSet*> malloc(sizeof(_BitSet))
* b.bitset = 0 # <<<<<<<<<<<<<<
@@ -19959,7 +21178,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
*/
__pyx_v_b->bitset = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":42
+ /* "cdec/sa/veb.pxi":42
* b = <_BitSet*> malloc(sizeof(_BitSet))
* b.bitset = 0
* b.min_val = -1 # <<<<<<<<<<<<<<
@@ -19968,7 +21187,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
*/
__pyx_v_b->min_val = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":43
+ /* "cdec/sa/veb.pxi":43
* b.bitset = 0
* b.min_val = -1
* b.max_val = -1 # <<<<<<<<<<<<<<
@@ -19977,7 +21196,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
*/
__pyx_v_b->max_val = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":44
+ /* "cdec/sa/veb.pxi":44
* b.min_val = -1
* b.max_val = -1
* b.size = 0 # <<<<<<<<<<<<<<
@@ -19986,7 +21205,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
*/
__pyx_v_b->size = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":45
+ /* "cdec/sa/veb.pxi":45
* b.max_val = -1
* b.size = 0
* return b # <<<<<<<<<<<<<<
@@ -19996,7 +21215,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
__pyx_r = __pyx_v_b;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":37
+ /* "cdec/sa/veb.pxi":37
*
*
* cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<<
@@ -20010,7 +21229,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":48
+/* "cdec/sa/veb.pxi":48
*
*
* cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20028,26 +21247,29 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("bitset_findsucc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":52
+ /* "cdec/sa/veb.pxi":52
* cdef int low, high, mid
*
* if b.max_val == -1 or i >= b.max_val: # <<<<<<<<<<<<<<
* return -1
* if i < b.min_val:
*/
- __pyx_t_1 = ((__pyx_v_b->max_val == -1) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i >= __pyx_v_b->max_val) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_b->max_val == -1) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L5_next_or:;
+ __pyx_t_2 = ((__pyx_v_i >= __pyx_v_b->max_val) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":53
+ /* "cdec/sa/veb.pxi":53
*
* if b.max_val == -1 or i >= b.max_val:
* return -1 # <<<<<<<<<<<<<<
@@ -20058,17 +21280,17 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":54
+ /* "cdec/sa/veb.pxi":54
* if b.max_val == -1 or i >= b.max_val:
* return -1
* if i < b.min_val: # <<<<<<<<<<<<<<
* return b.min_val
*
*/
- __pyx_t_3 = ((__pyx_v_i < __pyx_v_b->min_val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_i < __pyx_v_b->min_val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":55
+ /* "cdec/sa/veb.pxi":55
* return -1
* if i < b.min_val:
* return b.min_val # <<<<<<<<<<<<<<
@@ -20079,7 +21301,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":57
+ /* "cdec/sa/veb.pxi":57
* return b.min_val
*
* bitset = b.bitset & ~LOWER_MASK[i] # <<<<<<<<<<<<<<
@@ -20088,7 +21310,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i])));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":58
+ /* "cdec/sa/veb.pxi":58
*
* bitset = b.bitset & ~LOWER_MASK[i]
* low = i+1 # <<<<<<<<<<<<<<
@@ -20097,7 +21319,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_low = (__pyx_v_i + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":59
+ /* "cdec/sa/veb.pxi":59
* bitset = b.bitset & ~LOWER_MASK[i]
* low = i+1
* high = b.max_val+1 # <<<<<<<<<<<<<<
@@ -20106,7 +21328,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_high = (__pyx_v_b->max_val + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":60
+ /* "cdec/sa/veb.pxi":60
* low = i+1
* high = b.max_val+1
* while low < high-1: # <<<<<<<<<<<<<<
@@ -20114,10 +21336,10 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
* mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1])
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_low < (__pyx_v_high - 1)) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_low < (__pyx_v_high - 1)) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":61
+ /* "cdec/sa/veb.pxi":61
* high = b.max_val+1
* while low < high-1:
* mid = (high + low)/2 # <<<<<<<<<<<<<<
@@ -20126,7 +21348,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_mid = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":62
+ /* "cdec/sa/veb.pxi":62
* while low < high-1:
* mid = (high + low)/2
* mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) # <<<<<<<<<<<<<<
@@ -20135,17 +21357,17 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_mask = (~((__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_high - 1)]) ^ (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_mid - 1)])));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":63
+ /* "cdec/sa/veb.pxi":63
* mid = (high + low)/2
* mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1])
* if bitset & mask == 0: # <<<<<<<<<<<<<<
* low = mid
* else:
*/
- __pyx_t_3 = (((__pyx_v_bitset & __pyx_v_mask) == 0) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_bitset & __pyx_v_mask) == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":64
+ /* "cdec/sa/veb.pxi":64
* mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1])
* if bitset & mask == 0:
* low = mid # <<<<<<<<<<<<<<
@@ -20153,11 +21375,11 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
* bitset = bitset & mask
*/
__pyx_v_low = __pyx_v_mid;
- goto __pyx_L7;
+ goto __pyx_L9;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":66
+ /* "cdec/sa/veb.pxi":66
* low = mid
* else:
* bitset = bitset & mask # <<<<<<<<<<<<<<
@@ -20166,7 +21388,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_bitset = (__pyx_v_bitset & __pyx_v_mask);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":67
+ /* "cdec/sa/veb.pxi":67
* else:
* bitset = bitset & mask
* high = mid # <<<<<<<<<<<<<<
@@ -20175,10 +21397,10 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_high = __pyx_v_mid;
}
- __pyx_L7:;
+ __pyx_L9:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":68
+ /* "cdec/sa/veb.pxi":68
* bitset = bitset & mask
* high = mid
* return low # <<<<<<<<<<<<<<
@@ -20188,7 +21410,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
__pyx_r = __pyx_v_low;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":48
+ /* "cdec/sa/veb.pxi":48
*
*
* cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20202,7 +21424,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":71
+/* "cdec/sa/veb.pxi":71
*
*
* cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20217,7 +21439,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
int __pyx_t_1;
__Pyx_RefNannySetupContext("bitset_insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":74
+ /* "cdec/sa/veb.pxi":74
* cdef int val
*
* val = 1 << i # <<<<<<<<<<<<<<
@@ -20226,7 +21448,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
*/
__pyx_v_val = (1 << __pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":75
+ /* "cdec/sa/veb.pxi":75
*
* val = 1 << i
* if b.bitset & val == 0: # <<<<<<<<<<<<<<
@@ -20236,7 +21458,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
__pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":76
+ /* "cdec/sa/veb.pxi":76
* val = 1 << i
* if b.bitset & val == 0:
* b.bitset = b.bitset | val # <<<<<<<<<<<<<<
@@ -20245,7 +21467,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
*/
__pyx_v_b->bitset = (__pyx_v_b->bitset | __pyx_v_val);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":77
+ /* "cdec/sa/veb.pxi":77
* if b.bitset & val == 0:
* b.bitset = b.bitset | val
* if b.size == 0: # <<<<<<<<<<<<<<
@@ -20255,7 +21477,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
__pyx_t_1 = ((__pyx_v_b->size == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":78
+ /* "cdec/sa/veb.pxi":78
* b.bitset = b.bitset | val
* if b.size == 0:
* b.min_val = i # <<<<<<<<<<<<<<
@@ -20264,7 +21486,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
*/
__pyx_v_b->min_val = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":79
+ /* "cdec/sa/veb.pxi":79
* if b.size == 0:
* b.min_val = i
* b.max_val = i # <<<<<<<<<<<<<<
@@ -20276,7 +21498,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":81
+ /* "cdec/sa/veb.pxi":81
* b.max_val = i
* else:
* if i < b.min_val: # <<<<<<<<<<<<<<
@@ -20286,7 +21508,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
__pyx_t_1 = ((__pyx_v_i < __pyx_v_b->min_val) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":82
+ /* "cdec/sa/veb.pxi":82
* else:
* if i < b.min_val:
* b.min_val = i # <<<<<<<<<<<<<<
@@ -20298,7 +21520,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":83
+ /* "cdec/sa/veb.pxi":83
* if i < b.min_val:
* b.min_val = i
* if i > b.max_val: # <<<<<<<<<<<<<<
@@ -20308,7 +21530,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
__pyx_t_1 = ((__pyx_v_i > __pyx_v_b->max_val) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":84
+ /* "cdec/sa/veb.pxi":84
* b.min_val = i
* if i > b.max_val:
* b.max_val = i # <<<<<<<<<<<<<<
@@ -20322,7 +21544,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":85
+ /* "cdec/sa/veb.pxi":85
* if i > b.max_val:
* b.max_val = i
* b.size = b.size + 1 # <<<<<<<<<<<<<<
@@ -20331,7 +21553,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
*/
__pyx_v_b->size = (__pyx_v_b->size + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":86
+ /* "cdec/sa/veb.pxi":86
* b.max_val = i
* b.size = b.size + 1
* return 1 # <<<<<<<<<<<<<<
@@ -20342,7 +21564,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":87
+ /* "cdec/sa/veb.pxi":87
* b.size = b.size + 1
* return 1
* return 0 # <<<<<<<<<<<<<<
@@ -20352,7 +21574,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
__pyx_r = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":71
+ /* "cdec/sa/veb.pxi":71
*
*
* cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20366,7 +21588,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__B
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":90
+/* "cdec/sa/veb.pxi":90
*
*
* cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20381,7 +21603,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
int __pyx_t_1;
__Pyx_RefNannySetupContext("bitset_contains", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":93
+ /* "cdec/sa/veb.pxi":93
* cdef int val
*
* val = 1 << i # <<<<<<<<<<<<<<
@@ -20390,7 +21612,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
*/
__pyx_v_val = (1 << __pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":94
+ /* "cdec/sa/veb.pxi":94
*
* val = 1 << i
* if b.bitset & val == 0: # <<<<<<<<<<<<<<
@@ -20400,7 +21622,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
__pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":95
+ /* "cdec/sa/veb.pxi":95
* val = 1 << i
* if b.bitset & val == 0:
* return 0 # <<<<<<<<<<<<<<
@@ -20412,7 +21634,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":97
+ /* "cdec/sa/veb.pxi":97
* return 0
* else:
* return 1 # <<<<<<<<<<<<<<
@@ -20423,7 +21645,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":90
+ /* "cdec/sa/veb.pxi":90
*
*
* cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<<
@@ -20437,7 +21659,7 @@ static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":104
+/* "cdec/sa/veb.pxi":104
* cdef int next_val
*
* def __next__(self): # <<<<<<<<<<<<<<
@@ -20470,7 +21692,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__next__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":107
+ /* "cdec/sa/veb.pxi":107
* cdef int ret_val
*
* if self.next_val == -1: # <<<<<<<<<<<<<<
@@ -20480,21 +21702,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
__pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":108
+ /* "cdec/sa/veb.pxi":108
*
* if self.next_val == -1:
* raise StopIteration() # <<<<<<<<<<<<<<
* ret_val = self.next_val
* self.next_val = bitset_findsucc(self.b, ret_val)
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_StopIteration, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":109
+ /* "cdec/sa/veb.pxi":109
* if self.next_val == -1:
* raise StopIteration()
* ret_val = self.next_val # <<<<<<<<<<<<<<
@@ -20504,7 +21726,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
__pyx_t_3 = __pyx_v_self->next_val;
__pyx_v_ret_val = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":110
+ /* "cdec/sa/veb.pxi":110
* raise StopIteration()
* ret_val = self.next_val
* self.next_val = bitset_findsucc(self.b, ret_val) # <<<<<<<<<<<<<<
@@ -20513,7 +21735,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
*/
__pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":111
+ /* "cdec/sa/veb.pxi":111
* ret_val = self.next_val
* self.next_val = bitset_findsucc(self.b, ret_val)
* return ret_val # <<<<<<<<<<<<<<
@@ -20527,7 +21749,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":104
+ /* "cdec/sa/veb.pxi":104
* cdef int next_val
*
* def __next__(self): # <<<<<<<<<<<<<<
@@ -20546,7 +21768,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":122
+/* "cdec/sa/veb.pxi":122
* cdef _BitSet* b
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -20575,7 +21797,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":123
+ /* "cdec/sa/veb.pxi":123
*
* def __cinit__(self):
* self.b = new_BitSet() # <<<<<<<<<<<<<<
@@ -20584,7 +21806,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_self->b = __pyx_f_4cdec_2sa_3_sa_new_BitSet();
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":122
+ /* "cdec/sa/veb.pxi":122
* cdef _BitSet* b
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -20598,7 +21820,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":125
+/* "cdec/sa/veb.pxi":125
* self.b = new_BitSet()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -20621,7 +21843,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":126
+ /* "cdec/sa/veb.pxi":126
*
* def __dealloc__(self):
* free(self.b) # <<<<<<<<<<<<<<
@@ -20630,7 +21852,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_
*/
free(__pyx_v_self->b);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":125
+ /* "cdec/sa/veb.pxi":125
* self.b = new_BitSet()
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -20642,7 +21864,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":128
+/* "cdec/sa/veb.pxi":128
* free(self.b)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -20675,7 +21897,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":130
+ /* "cdec/sa/veb.pxi":130
* def __iter__(self):
* cdef BitSetIterator it
* it = BitSetIterator() # <<<<<<<<<<<<<<
@@ -20687,7 +21909,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
__pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":131
+ /* "cdec/sa/veb.pxi":131
* cdef BitSetIterator it
* it = BitSetIterator()
* it.b = self.b # <<<<<<<<<<<<<<
@@ -20697,7 +21919,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
__pyx_t_2 = __pyx_v_self->b;
__pyx_v_it->b = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":132
+ /* "cdec/sa/veb.pxi":132
* it = BitSetIterator()
* it.b = self.b
* it.next_val = self.b.min_val # <<<<<<<<<<<<<<
@@ -20707,7 +21929,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
__pyx_t_3 = __pyx_v_self->b->min_val;
__pyx_v_it->next_val = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":133
+ /* "cdec/sa/veb.pxi":133
* it.b = self.b
* it.next_val = self.b.min_val
* return it # <<<<<<<<<<<<<<
@@ -20719,7 +21941,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
__pyx_r = ((PyObject *)__pyx_v_it);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":128
+ /* "cdec/sa/veb.pxi":128
* free(self.b)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -20739,7 +21961,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":135
+/* "cdec/sa/veb.pxi":135
* return it
*
* def insert(self, i): # <<<<<<<<<<<<<<
@@ -20770,7 +21992,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":136
+ /* "cdec/sa/veb.pxi":136
*
* def insert(self, i):
* return bitset_insert(self.b, i) # <<<<<<<<<<<<<<
@@ -20785,7 +22007,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":135
+ /* "cdec/sa/veb.pxi":135
* return it
*
* def insert(self, i): # <<<<<<<<<<<<<<
@@ -20804,7 +22026,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":138
+/* "cdec/sa/veb.pxi":138
* return bitset_insert(self.b, i)
*
* def findsucc(self, i): # <<<<<<<<<<<<<<
@@ -20835,7 +22057,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("findsucc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":139
+ /* "cdec/sa/veb.pxi":139
*
* def findsucc(self, i):
* return bitset_findsucc(self.b, i) # <<<<<<<<<<<<<<
@@ -20850,7 +22072,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cde
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":138
+ /* "cdec/sa/veb.pxi":138
* return bitset_insert(self.b, i)
*
* def findsucc(self, i): # <<<<<<<<<<<<<<
@@ -20869,7 +22091,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":141
+/* "cdec/sa/veb.pxi":141
* return bitset_findsucc(self.b, i)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -20901,7 +22123,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cde
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":142
+ /* "cdec/sa/veb.pxi":142
*
* def __str__(self):
* return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")" # <<<<<<<<<<<<<<
@@ -20969,7 +22191,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cde
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":141
+ /* "cdec/sa/veb.pxi":141
* return bitset_findsucc(self.b, i)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -20990,7 +22212,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":144
+/* "cdec/sa/veb.pxi":144
* return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")"
*
* def min(self): # <<<<<<<<<<<<<<
@@ -21020,7 +22242,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("min", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":145
+ /* "cdec/sa/veb.pxi":145
*
* def min(self):
* return self.b.min_val # <<<<<<<<<<<<<<
@@ -21034,7 +22256,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2s
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":144
+ /* "cdec/sa/veb.pxi":144
* return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")"
*
* def min(self): # <<<<<<<<<<<<<<
@@ -21053,7 +22275,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":147
+/* "cdec/sa/veb.pxi":147
* return self.b.min_val
*
* def max(self): # <<<<<<<<<<<<<<
@@ -21083,7 +22305,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("max", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":148
+ /* "cdec/sa/veb.pxi":148
*
* def max(self):
* return self.b.max_val # <<<<<<<<<<<<<<
@@ -21097,7 +22319,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2s
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":147
+ /* "cdec/sa/veb.pxi":147
* return self.b.min_val
*
* def max(self): # <<<<<<<<<<<<<<
@@ -21116,7 +22338,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":150
+/* "cdec/sa/veb.pxi":150
* return self.b.max_val
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -21142,7 +22364,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":151
+ /* "cdec/sa/veb.pxi":151
*
* def __len__(self):
* return self.b.size # <<<<<<<<<<<<<<
@@ -21152,7 +22374,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cd
__pyx_r = __pyx_v_self->b->size;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":150
+ /* "cdec/sa/veb.pxi":150
* return self.b.max_val
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -21166,7 +22388,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":153
+/* "cdec/sa/veb.pxi":153
* return self.b.size
*
* def __contains__(self, i): # <<<<<<<<<<<<<<
@@ -21198,7 +22420,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":154
+ /* "cdec/sa/veb.pxi":154
*
* def __contains__(self, i):
* return bool(bitset_contains(self.b, i)) # <<<<<<<<<<<<<<
@@ -21213,7 +22435,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec
__pyx_r = (!(!__pyx_t_3));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":153
+ /* "cdec/sa/veb.pxi":153
* return self.b.size
*
* def __contains__(self, i): # <<<<<<<<<<<<<<
@@ -21231,7 +22453,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":157
+/* "cdec/sa/veb.pxi":157
*
*
* cdef str dec2bin(long i): # <<<<<<<<<<<<<<
@@ -21253,7 +22475,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("dec2bin", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":158
+ /* "cdec/sa/veb.pxi":158
*
* cdef str dec2bin(long i):
* cdef str result = "" # <<<<<<<<<<<<<<
@@ -21263,7 +22485,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
__Pyx_INCREF(__pyx_kp_s__32);
__pyx_v_result = __pyx_kp_s__32;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":160
+ /* "cdec/sa/veb.pxi":160
* cdef str result = ""
* cdef unsigned d
* for d in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<<
@@ -21274,7 +22496,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_d = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":161
+ /* "cdec/sa/veb.pxi":161
* cdef unsigned d
* for d in range(MIN_BOTTOM_SIZE):
* if i & LOWER_MASK[0] == 0: # <<<<<<<<<<<<<<
@@ -21284,7 +22506,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
__pyx_t_3 = (((__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[0])) == 0) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":162
+ /* "cdec/sa/veb.pxi":162
* for d in range(MIN_BOTTOM_SIZE):
* if i & LOWER_MASK[0] == 0:
* result = "0"+result # <<<<<<<<<<<<<<
@@ -21299,7 +22521,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":164
+ /* "cdec/sa/veb.pxi":164
* result = "0"+result
* else:
* result = "1"+result # <<<<<<<<<<<<<<
@@ -21313,7 +22535,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":165
+ /* "cdec/sa/veb.pxi":165
* else:
* result = "1"+result
* i = i >> 1 # <<<<<<<<<<<<<<
@@ -21323,7 +22545,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
__pyx_v_i = (__pyx_v_i >> 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":166
+ /* "cdec/sa/veb.pxi":166
* result = "1"+result
* i = i >> 1
* return result # <<<<<<<<<<<<<<
@@ -21335,7 +22557,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":157
+ /* "cdec/sa/veb.pxi":157
*
*
* cdef str dec2bin(long i): # <<<<<<<<<<<<<<
@@ -21355,7 +22577,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) {
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":177
+/* "cdec/sa/veb.pxi":177
* void** bottom
*
* cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<<
@@ -21376,7 +22598,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("new_VEB", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":181
+ /* "cdec/sa/veb.pxi":181
* cdef int num_bits, num_top_bits, i
*
* veb = <_VEB*> malloc(sizeof(_VEB)) # <<<<<<<<<<<<<<
@@ -21385,7 +22607,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__VEB))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":183
+ /* "cdec/sa/veb.pxi":183
* veb = <_VEB*> malloc(sizeof(_VEB))
*
* num_bits = int(ceil(log(n) / log(2))) # <<<<<<<<<<<<<<
@@ -21406,7 +22628,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
}
__pyx_v_num_bits = ((int)ceil((__pyx_t_1 / __pyx_t_2)));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":184
+ /* "cdec/sa/veb.pxi":184
*
* num_bits = int(ceil(log(n) / log(2)))
* veb.num_bottom_bits = num_bits/2 # <<<<<<<<<<<<<<
@@ -21415,7 +22637,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->num_bottom_bits = __Pyx_div_long(__pyx_v_num_bits, 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":185
+ /* "cdec/sa/veb.pxi":185
* num_bits = int(ceil(log(n) / log(2)))
* veb.num_bottom_bits = num_bits/2
* if veb.num_bottom_bits < MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
@@ -21425,7 +22647,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
__pyx_t_3 = ((__pyx_v_veb->num_bottom_bits < __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":186
+ /* "cdec/sa/veb.pxi":186
* veb.num_bottom_bits = num_bits/2
* if veb.num_bottom_bits < MIN_BOTTOM_BITS:
* veb.num_bottom_bits = MIN_BOTTOM_BITS # <<<<<<<<<<<<<<
@@ -21437,7 +22659,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":187
+ /* "cdec/sa/veb.pxi":187
* if veb.num_bottom_bits < MIN_BOTTOM_BITS:
* veb.num_bottom_bits = MIN_BOTTOM_BITS
* veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 # <<<<<<<<<<<<<<
@@ -21446,7 +22668,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->top_universe_size = ((__pyx_v_n >> __pyx_v_veb->num_bottom_bits) + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":189
+ /* "cdec/sa/veb.pxi":189
* veb.top_universe_size = (n >> veb.num_bottom_bits) + 1
*
* veb.bottom = <void**> malloc(veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<<
@@ -21455,7 +22677,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->bottom = ((void **)malloc((__pyx_v_veb->top_universe_size * (sizeof(void *)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":190
+ /* "cdec/sa/veb.pxi":190
*
* veb.bottom = <void**> malloc(veb.top_universe_size * sizeof(void*))
* memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<<
@@ -21464,7 +22686,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
memset(__pyx_v_veb->bottom, 0, (__pyx_v_veb->top_universe_size * (sizeof(void *))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":192
+ /* "cdec/sa/veb.pxi":192
* memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*))
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
@@ -21474,7 +22696,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
__pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":193
+ /* "cdec/sa/veb.pxi":193
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* veb.top = new_VEB(veb.top_universe_size) # <<<<<<<<<<<<<<
@@ -21486,7 +22708,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":195
+ /* "cdec/sa/veb.pxi":195
* veb.top = new_VEB(veb.top_universe_size)
* else:
* veb.top = new_BitSet() # <<<<<<<<<<<<<<
@@ -21497,7 +22719,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":197
+ /* "cdec/sa/veb.pxi":197
* veb.top = new_BitSet()
*
* veb.max_val = -1 # <<<<<<<<<<<<<<
@@ -21506,7 +22728,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->max_val = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":198
+ /* "cdec/sa/veb.pxi":198
*
* veb.max_val = -1
* veb.min_val = -1 # <<<<<<<<<<<<<<
@@ -21515,7 +22737,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->min_val = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":199
+ /* "cdec/sa/veb.pxi":199
* veb.max_val = -1
* veb.min_val = -1
* veb.size = 0 # <<<<<<<<<<<<<<
@@ -21524,7 +22746,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
*/
__pyx_v_veb->size = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":200
+ /* "cdec/sa/veb.pxi":200
* veb.min_val = -1
* veb.size = 0
* return veb # <<<<<<<<<<<<<<
@@ -21534,7 +22756,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
__pyx_r = __pyx_v_veb;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":177
+ /* "cdec/sa/veb.pxi":177
* void** bottom
*
* cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<<
@@ -21551,7 +22773,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":203
+/* "cdec/sa/veb.pxi":203
*
*
* cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -21570,10 +22792,9 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
__Pyx_RefNannySetupContext("VEB_insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":208
+ /* "cdec/sa/veb.pxi":208
* cdef int a, b, tmp
*
* if veb.size == 0: # <<<<<<<<<<<<<<
@@ -21583,7 +22804,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
__pyx_t_1 = ((__pyx_v_veb->size == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":209
+ /* "cdec/sa/veb.pxi":209
*
* if veb.size == 0:
* veb.min_val = i # <<<<<<<<<<<<<<
@@ -21592,7 +22813,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_veb->min_val = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":210
+ /* "cdec/sa/veb.pxi":210
* if veb.size == 0:
* veb.min_val = i
* veb.max_val = i # <<<<<<<<<<<<<<
@@ -21603,23 +22824,27 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":211
+ /* "cdec/sa/veb.pxi":211
* veb.min_val = i
* veb.max_val = i
* elif i == veb.min_val or i == veb.max_val: # <<<<<<<<<<<<<<
* return 0
* else:
*/
- __pyx_t_1 = ((__pyx_v_i == __pyx_v_veb->min_val) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i == __pyx_v_veb->max_val) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_i == __pyx_v_veb->min_val) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L5_next_or:;
+ __pyx_t_2 = ((__pyx_v_i == __pyx_v_veb->max_val) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":212
+ /* "cdec/sa/veb.pxi":212
* veb.max_val = i
* elif i == veb.min_val or i == veb.max_val:
* return 0 # <<<<<<<<<<<<<<
@@ -21631,17 +22856,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":214
+ /* "cdec/sa/veb.pxi":214
* return 0
* else:
* if i < veb.min_val: # <<<<<<<<<<<<<<
* tmp = i
* i = veb.min_val
*/
- __pyx_t_3 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":215
+ /* "cdec/sa/veb.pxi":215
* else:
* if i < veb.min_val:
* tmp = i # <<<<<<<<<<<<<<
@@ -21650,17 +22875,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_tmp = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":216
+ /* "cdec/sa/veb.pxi":216
* if i < veb.min_val:
* tmp = i
* i = veb.min_val # <<<<<<<<<<<<<<
* veb.min_val = tmp
* a = i >> veb.num_bottom_bits
*/
- __pyx_t_4 = __pyx_v_veb->min_val;
- __pyx_v_i = __pyx_t_4;
+ __pyx_t_3 = __pyx_v_veb->min_val;
+ __pyx_v_i = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":217
+ /* "cdec/sa/veb.pxi":217
* tmp = i
* i = veb.min_val
* veb.min_val = tmp # <<<<<<<<<<<<<<
@@ -21668,11 +22893,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
*/
__pyx_v_veb->min_val = __pyx_v_tmp;
- goto __pyx_L4;
+ goto __pyx_L6;
}
- __pyx_L4:;
+ __pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":218
+ /* "cdec/sa/veb.pxi":218
* i = veb.min_val
* veb.min_val = tmp
* a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<<
@@ -21681,7 +22906,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":219
+ /* "cdec/sa/veb.pxi":219
* veb.min_val = tmp
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<<
@@ -21690,27 +22915,27 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":220
+ /* "cdec/sa/veb.pxi":220
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* if veb.bottom[a] == NULL: # <<<<<<<<<<<<<<
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top
*/
- __pyx_t_3 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":221
+ /* "cdec/sa/veb.pxi":221
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* if veb.bottom[a] == NULL:
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.top
* VEB_insert(subv, a)
*/
- __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":222
+ /* "cdec/sa/veb.pxi":222
* if veb.bottom[a] == NULL:
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top # <<<<<<<<<<<<<<
@@ -21719,7 +22944,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":223
+ /* "cdec/sa/veb.pxi":223
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top
* VEB_insert(subv, a) # <<<<<<<<<<<<<<
@@ -21727,11 +22952,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
* subb = <_BitSet*> veb.top
*/
__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a);
- goto __pyx_L6;
+ goto __pyx_L8;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":225
+ /* "cdec/sa/veb.pxi":225
* VEB_insert(subv, a)
* else:
* subb = <_BitSet*> veb.top # <<<<<<<<<<<<<<
@@ -21740,7 +22965,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":226
+ /* "cdec/sa/veb.pxi":226
* else:
* subb = <_BitSet*> veb.top
* bitset_insert(subb, a) # <<<<<<<<<<<<<<
@@ -21749,19 +22974,19 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a);
}
- __pyx_L6:;
+ __pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":227
+ /* "cdec/sa/veb.pxi":227
* subb = <_BitSet*> veb.top
* bitset_insert(subb, a)
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
* veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits)
* else:
*/
- __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":228
+ /* "cdec/sa/veb.pxi":228
* bitset_insert(subb, a)
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) # <<<<<<<<<<<<<<
@@ -21769,11 +22994,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
* veb.bottom[a] = new_BitSet()
*/
(__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_4cdec_2sa_3_sa_new_VEB((1 << __pyx_v_veb->num_bottom_bits));
- goto __pyx_L7;
+ goto __pyx_L9;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":230
+ /* "cdec/sa/veb.pxi":230
* veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits)
* else:
* veb.bottom[a] = new_BitSet() # <<<<<<<<<<<<<<
@@ -21782,22 +23007,22 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
(__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_4cdec_2sa_3_sa_new_BitSet();
}
- __pyx_L7:;
- goto __pyx_L5;
+ __pyx_L9:;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":231
+ /* "cdec/sa/veb.pxi":231
* else:
* veb.bottom[a] = new_BitSet()
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.bottom[a]
* if VEB_insert(subv, b) == 0:
*/
- __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":232
+ /* "cdec/sa/veb.pxi":232
* veb.bottom[a] = new_BitSet()
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -21806,17 +23031,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":233
+ /* "cdec/sa/veb.pxi":233
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a]
* if VEB_insert(subv, b) == 0: # <<<<<<<<<<<<<<
* return 0
* else:
*/
- __pyx_t_3 = ((__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":234
+ /* "cdec/sa/veb.pxi":234
* subv = <_VEB*> veb.bottom[a]
* if VEB_insert(subv, b) == 0:
* return 0 # <<<<<<<<<<<<<<
@@ -21826,11 +23051,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
__pyx_r = 0;
goto __pyx_L0;
}
- goto __pyx_L8;
+ goto __pyx_L10;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":236
+ /* "cdec/sa/veb.pxi":236
* return 0
* else:
* subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -21839,17 +23064,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":237
+ /* "cdec/sa/veb.pxi":237
* else:
* subb = <_BitSet*> veb.bottom[a]
* if bitset_insert(subb, b) == 0: # <<<<<<<<<<<<<<
* return 0
*
*/
- __pyx_t_3 = ((__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":238
+ /* "cdec/sa/veb.pxi":238
* subb = <_BitSet*> veb.bottom[a]
* if bitset_insert(subb, b) == 0:
* return 0 # <<<<<<<<<<<<<<
@@ -21860,19 +23085,19 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
goto __pyx_L0;
}
}
- __pyx_L8:;
+ __pyx_L10:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":240
+ /* "cdec/sa/veb.pxi":240
* return 0
*
* if i > veb.max_val: # <<<<<<<<<<<<<<
* veb.max_val = i
* veb.size = veb.size + 1
*/
- __pyx_t_3 = ((__pyx_v_i > __pyx_v_veb->max_val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_i > __pyx_v_veb->max_val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":241
+ /* "cdec/sa/veb.pxi":241
*
* if i > veb.max_val:
* veb.max_val = i # <<<<<<<<<<<<<<
@@ -21880,13 +23105,13 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
* return 1
*/
__pyx_v_veb->max_val = __pyx_v_i;
- goto __pyx_L11;
+ goto __pyx_L13;
}
- __pyx_L11:;
+ __pyx_L13:;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":242
+ /* "cdec/sa/veb.pxi":242
* if i > veb.max_val:
* veb.max_val = i
* veb.size = veb.size + 1 # <<<<<<<<<<<<<<
@@ -21895,7 +23120,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
*/
__pyx_v_veb->size = (__pyx_v_veb->size + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":243
+ /* "cdec/sa/veb.pxi":243
* veb.max_val = i
* veb.size = veb.size + 1
* return 1 # <<<<<<<<<<<<<<
@@ -21905,7 +23130,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
__pyx_r = 1;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":203
+ /* "cdec/sa/veb.pxi":203
*
*
* cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -21919,7 +23144,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":246
+/* "cdec/sa/veb.pxi":246
*
*
* cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<<
@@ -21939,7 +23164,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("del_VEB", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":249
+ /* "cdec/sa/veb.pxi":249
* cdef int i
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
@@ -21949,7 +23174,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":250
+ /* "cdec/sa/veb.pxi":250
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* i = (<_VEB*> veb.top).min_val # <<<<<<<<<<<<<<
@@ -21962,7 +23187,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":252
+ /* "cdec/sa/veb.pxi":252
* i = (<_VEB*> veb.top).min_val
* else:
* i = (<_BitSet*> veb.top).min_val # <<<<<<<<<<<<<<
@@ -21974,7 +23199,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":254
+ /* "cdec/sa/veb.pxi":254
* i = (<_BitSet*> veb.top).min_val
*
* while i != -1: # <<<<<<<<<<<<<<
@@ -21985,7 +23210,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_t_1 = ((__pyx_v_i != -1) != 0);
if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":255
+ /* "cdec/sa/veb.pxi":255
*
* while i != -1:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
@@ -21995,7 +23220,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":256
+ /* "cdec/sa/veb.pxi":256
* while i != -1:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* del_VEB(<_VEB*> veb.bottom[i]) # <<<<<<<<<<<<<<
@@ -22009,7 +23234,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":258
+ /* "cdec/sa/veb.pxi":258
* del_VEB(<_VEB*> veb.bottom[i])
* else:
* free(<_BitSet*> veb.bottom[i]) # <<<<<<<<<<<<<<
@@ -22020,7 +23245,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":260
+ /* "cdec/sa/veb.pxi":260
* free(<_BitSet*> veb.bottom[i])
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
@@ -22030,7 +23255,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":261
+ /* "cdec/sa/veb.pxi":261
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* i = VEB_findsucc(<_VEB*> veb.top, i) # <<<<<<<<<<<<<<
@@ -22042,7 +23267,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":263
+ /* "cdec/sa/veb.pxi":263
* i = VEB_findsucc(<_VEB*> veb.top, i)
* else:
* i = bitset_findsucc(<_BitSet*> veb.top, i) # <<<<<<<<<<<<<<
@@ -22054,7 +23279,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_L7:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":265
+ /* "cdec/sa/veb.pxi":265
* i = bitset_findsucc(<_BitSet*> veb.top, i)
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
@@ -22064,7 +23289,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
__pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":266
+ /* "cdec/sa/veb.pxi":266
*
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* del_VEB(<_VEB*> veb.top) # <<<<<<<<<<<<<<
@@ -22078,7 +23303,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":268
+ /* "cdec/sa/veb.pxi":268
* del_VEB(<_VEB*> veb.top)
* else:
* free(<_BitSet*> veb.top) # <<<<<<<<<<<<<<
@@ -22089,7 +23314,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
}
__pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":269
+ /* "cdec/sa/veb.pxi":269
* else:
* free(<_BitSet*> veb.top)
* free(veb.bottom) # <<<<<<<<<<<<<<
@@ -22098,7 +23323,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
*/
free(__pyx_v_veb->bottom);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":270
+ /* "cdec/sa/veb.pxi":270
* free(<_BitSet*> veb.top)
* free(veb.bottom)
* free(veb) # <<<<<<<<<<<<<<
@@ -22107,7 +23332,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
*/
free(__pyx_v_veb);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":246
+ /* "cdec/sa/veb.pxi":246
*
*
* cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<<
@@ -22128,7 +23353,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__V
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":273
+/* "cdec/sa/veb.pxi":273
*
*
* cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -22148,26 +23373,29 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("VEB_findsucc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":278
+ /* "cdec/sa/veb.pxi":278
* cdef int a, b, j, c, found
*
* if veb.max_val == -1 or i>=veb.max_val: # <<<<<<<<<<<<<<
* return -1
* if i < veb.min_val:
*/
- __pyx_t_1 = ((__pyx_v_veb->max_val == -1) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i >= __pyx_v_veb->max_val) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_veb->max_val == -1) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L5_next_or:;
+ __pyx_t_2 = ((__pyx_v_i >= __pyx_v_veb->max_val) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":279
+ /* "cdec/sa/veb.pxi":279
*
* if veb.max_val == -1 or i>=veb.max_val:
* return -1 # <<<<<<<<<<<<<<
@@ -22178,17 +23406,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":280
+ /* "cdec/sa/veb.pxi":280
* if veb.max_val == -1 or i>=veb.max_val:
* return -1
* if i < veb.min_val: # <<<<<<<<<<<<<<
* return veb.min_val
*
*/
- __pyx_t_3 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":281
+ /* "cdec/sa/veb.pxi":281
* return -1
* if i < veb.min_val:
* return veb.min_val # <<<<<<<<<<<<<<
@@ -22199,7 +23427,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":283
+ /* "cdec/sa/veb.pxi":283
* return veb.min_val
*
* a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<<
@@ -22208,7 +23436,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":284
+ /* "cdec/sa/veb.pxi":284
*
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<<
@@ -22217,7 +23445,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":285
+ /* "cdec/sa/veb.pxi":285
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* found = 0 # <<<<<<<<<<<<<<
@@ -22226,27 +23454,27 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_found = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":286
+ /* "cdec/sa/veb.pxi":286
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* found = 0
* if veb.bottom[a] != NULL: # <<<<<<<<<<<<<<
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a]
*/
- __pyx_t_3 = (((__pyx_v_veb->bottom[__pyx_v_a]) != NULL) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_veb->bottom[__pyx_v_a]) != NULL) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":287
+ /* "cdec/sa/veb.pxi":287
* found = 0
* if veb.bottom[a] != NULL:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.bottom[a]
* if subv.max_val > b:
*/
- __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":288
+ /* "cdec/sa/veb.pxi":288
* if veb.bottom[a] != NULL:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -22255,17 +23483,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":289
+ /* "cdec/sa/veb.pxi":289
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a]
* if subv.max_val > b: # <<<<<<<<<<<<<<
* j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b)
* found = 1
*/
- __pyx_t_3 = ((__pyx_v_subv->max_val > __pyx_v_b) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_subv->max_val > __pyx_v_b) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":290
+ /* "cdec/sa/veb.pxi":290
* subv = <_VEB*> veb.bottom[a]
* if subv.max_val > b:
* j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) # <<<<<<<<<<<<<<
@@ -22274,7 +23502,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_b));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":291
+ /* "cdec/sa/veb.pxi":291
* if subv.max_val > b:
* j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b)
* found = 1 # <<<<<<<<<<<<<<
@@ -22282,14 +23510,14 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
* subb = <_BitSet*> veb.bottom[a]
*/
__pyx_v_found = 1;
- goto __pyx_L7;
+ goto __pyx_L9;
}
- __pyx_L7:;
- goto __pyx_L6;
+ __pyx_L9:;
+ goto __pyx_L8;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":293
+ /* "cdec/sa/veb.pxi":293
* found = 1
* else:
* subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -22298,17 +23526,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":294
+ /* "cdec/sa/veb.pxi":294
* else:
* subb = <_BitSet*> veb.bottom[a]
* if subb.max_val > b: # <<<<<<<<<<<<<<
* j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b)
* found = 1
*/
- __pyx_t_3 = ((__pyx_v_subb->max_val > __pyx_v_b) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_subb->max_val > __pyx_v_b) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":295
+ /* "cdec/sa/veb.pxi":295
* subb = <_BitSet*> veb.bottom[a]
* if subb.max_val > b:
* j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) # <<<<<<<<<<<<<<
@@ -22317,7 +23545,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_b));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":296
+ /* "cdec/sa/veb.pxi":296
* if subb.max_val > b:
* j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b)
* found = 1 # <<<<<<<<<<<<<<
@@ -22325,36 +23553,36 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
*/
__pyx_v_found = 1;
- goto __pyx_L8;
+ goto __pyx_L10;
}
- __pyx_L8:;
+ __pyx_L10:;
}
- __pyx_L6:;
- goto __pyx_L5;
+ __pyx_L8:;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":297
+ /* "cdec/sa/veb.pxi":297
* j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b)
* found = 1
* if found==0: # <<<<<<<<<<<<<<
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top
*/
- __pyx_t_3 = ((__pyx_v_found == 0) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_found == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":298
+ /* "cdec/sa/veb.pxi":298
* found = 1
* if found==0:
* if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.top
* c = VEB_findsucc(subv, a)
*/
- __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":299
+ /* "cdec/sa/veb.pxi":299
* if found==0:
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top # <<<<<<<<<<<<<<
@@ -22363,7 +23591,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":300
+ /* "cdec/sa/veb.pxi":300
* if veb.top_universe_size > MIN_BOTTOM_SIZE:
* subv = <_VEB*> veb.top
* c = VEB_findsucc(subv, a) # <<<<<<<<<<<<<<
@@ -22371,11 +23599,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
* subb = <_BitSet*> veb.top
*/
__pyx_v_c = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a);
- goto __pyx_L10;
+ goto __pyx_L12;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":302
+ /* "cdec/sa/veb.pxi":302
* c = VEB_findsucc(subv, a)
* else:
* subb = <_BitSet*> veb.top # <<<<<<<<<<<<<<
@@ -22384,7 +23612,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":303
+ /* "cdec/sa/veb.pxi":303
* else:
* subb = <_BitSet*> veb.top
* c = bitset_findsucc(subb, a) # <<<<<<<<<<<<<<
@@ -22393,19 +23621,19 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_c = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a);
}
- __pyx_L10:;
+ __pyx_L12:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":304
+ /* "cdec/sa/veb.pxi":304
* subb = <_BitSet*> veb.top
* c = bitset_findsucc(subb, a)
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.bottom[c]
* j = (c << veb.num_bottom_bits) + subv.min_val
*/
- __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":305
+ /* "cdec/sa/veb.pxi":305
* c = bitset_findsucc(subb, a)
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[c] # <<<<<<<<<<<<<<
@@ -22414,7 +23642,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":306
+ /* "cdec/sa/veb.pxi":306
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[c]
* j = (c << veb.num_bottom_bits) + subv.min_val # <<<<<<<<<<<<<<
@@ -22422,11 +23650,11 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
* subb = <_BitSet*> veb.bottom[c]
*/
__pyx_v_j = ((__pyx_v_c << __pyx_v_veb->num_bottom_bits) + __pyx_v_subv->min_val);
- goto __pyx_L11;
+ goto __pyx_L13;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":308
+ /* "cdec/sa/veb.pxi":308
* j = (c << veb.num_bottom_bits) + subv.min_val
* else:
* subb = <_BitSet*> veb.bottom[c] # <<<<<<<<<<<<<<
@@ -22435,7 +23663,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":309
+ /* "cdec/sa/veb.pxi":309
* else:
* subb = <_BitSet*> veb.bottom[c]
* j = (c << veb.num_bottom_bits) + subb.min_val # <<<<<<<<<<<<<<
@@ -22444,12 +23672,12 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_j = ((__pyx_v_c << __pyx_v_veb->num_bottom_bits) + __pyx_v_subb->min_val);
}
- __pyx_L11:;
- goto __pyx_L9;
+ __pyx_L13:;
+ goto __pyx_L11;
}
- __pyx_L9:;
+ __pyx_L11:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":310
+ /* "cdec/sa/veb.pxi":310
* subb = <_BitSet*> veb.bottom[c]
* j = (c << veb.num_bottom_bits) + subb.min_val
* return j # <<<<<<<<<<<<<<
@@ -22459,7 +23687,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
__pyx_r = __pyx_v_j;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":273
+ /* "cdec/sa/veb.pxi":273
*
*
* cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -22473,7 +23701,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VE
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":313
+/* "cdec/sa/veb.pxi":313
*
*
* cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -22490,33 +23718,37 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
__Pyx_RefNannySetupContext("VEB_contains", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":318
+ /* "cdec/sa/veb.pxi":318
* cdef int a, b
*
* if veb.size == 0 or i < veb.min_val or i > veb.max_val: # <<<<<<<<<<<<<<
* return 0
*
*/
- __pyx_t_1 = ((__pyx_v_veb->size == 0) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
- if (!__pyx_t_2) {
- __pyx_t_3 = ((__pyx_v_i > __pyx_v_veb->max_val) != 0);
- __pyx_t_4 = __pyx_t_3;
- } else {
- __pyx_t_4 = __pyx_t_2;
- }
- __pyx_t_2 = __pyx_t_4;
+ __pyx_t_2 = ((__pyx_v_veb->size == 0) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_2 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_2) {
+ __pyx_L5_next_or:;
+ __pyx_t_2 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L6_next_or;
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_L6_next_or:;
+ __pyx_t_2 = ((__pyx_v_i > __pyx_v_veb->max_val) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":319
+ /* "cdec/sa/veb.pxi":319
*
* if veb.size == 0 or i < veb.min_val or i > veb.max_val:
* return 0 # <<<<<<<<<<<<<<
@@ -22527,17 +23759,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":321
+ /* "cdec/sa/veb.pxi":321
* return 0
*
* if veb.min_val == i: # <<<<<<<<<<<<<<
* return 1
* else:
*/
- __pyx_t_2 = ((__pyx_v_veb->min_val == __pyx_v_i) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_veb->min_val == __pyx_v_i) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":322
+ /* "cdec/sa/veb.pxi":322
*
* if veb.min_val == i:
* return 1 # <<<<<<<<<<<<<<
@@ -22549,17 +23781,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":324
+ /* "cdec/sa/veb.pxi":324
* return 1
* else:
* if veb.size == 1: # <<<<<<<<<<<<<<
* return 0
*
*/
- __pyx_t_2 = ((__pyx_v_veb->size == 1) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_veb->size == 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":325
+ /* "cdec/sa/veb.pxi":325
* else:
* if veb.size == 1:
* return 0 # <<<<<<<<<<<<<<
@@ -22571,7 +23803,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":327
+ /* "cdec/sa/veb.pxi":327
* return 0
*
* a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<<
@@ -22580,7 +23812,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":328
+ /* "cdec/sa/veb.pxi":328
*
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<<
@@ -22589,17 +23821,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":329
+ /* "cdec/sa/veb.pxi":329
* a = i >> veb.num_bottom_bits
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* if veb.bottom[a] == NULL: # <<<<<<<<<<<<<<
* return 0
* else:
*/
- __pyx_t_2 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":330
+ /* "cdec/sa/veb.pxi":330
* b = i & LOWER_MASK[veb.num_bottom_bits-1]
* if veb.bottom[a] == NULL:
* return 0 # <<<<<<<<<<<<<<
@@ -22611,17 +23843,17 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":332
+ /* "cdec/sa/veb.pxi":332
* return 0
* else:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<<
* subv = <_VEB*> veb.bottom[a]
* return VEB_contains(subv, b)
*/
- __pyx_t_2 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":333
+ /* "cdec/sa/veb.pxi":333
* else:
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -22630,7 +23862,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":334
+ /* "cdec/sa/veb.pxi":334
* if veb.num_bottom_bits > MIN_BOTTOM_BITS:
* subv = <_VEB*> veb.bottom[a]
* return VEB_contains(subv, b) # <<<<<<<<<<<<<<
@@ -22642,7 +23874,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":336
+ /* "cdec/sa/veb.pxi":336
* return VEB_contains(subv, b)
* else:
* subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<<
@@ -22651,7 +23883,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
*/
__pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":337
+ /* "cdec/sa/veb.pxi":337
* else:
* subb = <_BitSet*> veb.bottom[a]
* return bitset_contains(subb, b) # <<<<<<<<<<<<<<
@@ -22663,7 +23895,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":313
+ /* "cdec/sa/veb.pxi":313
*
*
* cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<<
@@ -22677,7 +23909,7 @@ static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VE
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":344
+/* "cdec/sa/veb.pxi":344
* cdef int next_val
*
* def __next__(self): # <<<<<<<<<<<<<<
@@ -22710,7 +23942,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__next__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":347
+ /* "cdec/sa/veb.pxi":347
* cdef int ret_val
*
* if self.next_val == -1: # <<<<<<<<<<<<<<
@@ -22720,21 +23952,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
__pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":348
+ /* "cdec/sa/veb.pxi":348
*
* if self.next_val == -1:
* raise StopIteration() # <<<<<<<<<<<<<<
* ret_val = self.next_val
* self.next_val = VEB_findsucc(self.v, ret_val)
*/
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_StopIteration, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[6]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":349
+ /* "cdec/sa/veb.pxi":349
* if self.next_val == -1:
* raise StopIteration()
* ret_val = self.next_val # <<<<<<<<<<<<<<
@@ -22744,7 +23976,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
__pyx_t_3 = __pyx_v_self->next_val;
__pyx_v_ret_val = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":350
+ /* "cdec/sa/veb.pxi":350
* raise StopIteration()
* ret_val = self.next_val
* self.next_val = VEB_findsucc(self.v, ret_val) # <<<<<<<<<<<<<<
@@ -22753,7 +23985,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
*/
__pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":351
+ /* "cdec/sa/veb.pxi":351
* ret_val = self.next_val
* self.next_val = VEB_findsucc(self.v, ret_val)
* return ret_val # <<<<<<<<<<<<<<
@@ -22767,7 +23999,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":344
+ /* "cdec/sa/veb.pxi":344
* cdef int next_val
*
* def __next__(self): # <<<<<<<<<<<<<<
@@ -22786,7 +24018,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":360
+/* "cdec/sa/veb.pxi":360
* cdef int _first(self)
*
* def __cinit__(self, int size): # <<<<<<<<<<<<<<
@@ -22851,7 +24083,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":361
+ /* "cdec/sa/veb.pxi":361
*
* def __cinit__(self, int size):
* self.veb = new_VEB(size) # <<<<<<<<<<<<<<
@@ -22860,7 +24092,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_s
*/
__pyx_v_self->veb = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":360
+ /* "cdec/sa/veb.pxi":360
* cdef int _first(self)
*
* def __cinit__(self, int size): # <<<<<<<<<<<<<<
@@ -22874,7 +24106,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":363
+/* "cdec/sa/veb.pxi":363
* self.veb = new_VEB(size)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -22901,7 +24133,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":364
+ /* "cdec/sa/veb.pxi":364
*
* def __dealloc__(self):
* del_VEB(self.veb) # <<<<<<<<<<<<<<
@@ -22912,7 +24144,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":363
+ /* "cdec/sa/veb.pxi":363
* self.veb = new_VEB(size)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -22929,7 +24161,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":366
+/* "cdec/sa/veb.pxi":366
* del_VEB(self.veb)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -22962,7 +24194,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":368
+ /* "cdec/sa/veb.pxi":368
* def __iter__(self):
* cdef VEBIterator it
* it = VEBIterator() # <<<<<<<<<<<<<<
@@ -22974,7 +24206,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
__pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":369
+ /* "cdec/sa/veb.pxi":369
* cdef VEBIterator it
* it = VEBIterator()
* it.v = self.veb # <<<<<<<<<<<<<<
@@ -22984,7 +24216,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
__pyx_t_2 = __pyx_v_self->veb;
__pyx_v_it->v = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":370
+ /* "cdec/sa/veb.pxi":370
* it = VEBIterator()
* it.v = self.veb
* it.next_val = self.veb.min_val # <<<<<<<<<<<<<<
@@ -22994,7 +24226,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
__pyx_t_3 = __pyx_v_self->veb->min_val;
__pyx_v_it->next_val = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":371
+ /* "cdec/sa/veb.pxi":371
* it.v = self.veb
* it.next_val = self.veb.min_val
* return it # <<<<<<<<<<<<<<
@@ -23006,7 +24238,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
__pyx_r = ((PyObject *)__pyx_v_it);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":366
+ /* "cdec/sa/veb.pxi":366
* del_VEB(self.veb)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -23026,7 +24258,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":373
+/* "cdec/sa/veb.pxi":373
* return it
*
* def insert(self, i): # <<<<<<<<<<<<<<
@@ -23057,7 +24289,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":374
+ /* "cdec/sa/veb.pxi":374
*
* def insert(self, i):
* return VEB_insert(self.veb, i) # <<<<<<<<<<<<<<
@@ -23072,7 +24304,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":373
+ /* "cdec/sa/veb.pxi":373
* return it
*
* def insert(self, i): # <<<<<<<<<<<<<<
@@ -23091,7 +24323,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":376
+/* "cdec/sa/veb.pxi":376
* return VEB_insert(self.veb, i)
*
* cdef int _insert(self, int i): # <<<<<<<<<<<<<<
@@ -23104,7 +24336,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__insert(struct __pyx_obj_4cdec_2sa_3_sa_V
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":377
+ /* "cdec/sa/veb.pxi":377
*
* cdef int _insert(self, int i):
* return VEB_insert(self.veb, i) # <<<<<<<<<<<<<<
@@ -23114,7 +24346,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__insert(struct __pyx_obj_4cdec_2sa_3_sa_V
__pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":376
+ /* "cdec/sa/veb.pxi":376
* return VEB_insert(self.veb, i)
*
* cdef int _insert(self, int i): # <<<<<<<<<<<<<<
@@ -23128,7 +24360,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__insert(struct __pyx_obj_4cdec_2sa_3_sa_V
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":379
+/* "cdec/sa/veb.pxi":379
* return VEB_insert(self.veb, i)
*
* def findsucc(self, i): # <<<<<<<<<<<<<<
@@ -23159,7 +24391,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("findsucc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":380
+ /* "cdec/sa/veb.pxi":380
*
* def findsucc(self, i):
* return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<<
@@ -23174,7 +24406,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":379
+ /* "cdec/sa/veb.pxi":379
* return VEB_insert(self.veb, i)
*
* def findsucc(self, i): # <<<<<<<<<<<<<<
@@ -23193,7 +24425,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":382
+/* "cdec/sa/veb.pxi":382
* return VEB_findsucc(self.veb, i)
*
* cdef int _first(self): # <<<<<<<<<<<<<<
@@ -23206,7 +24438,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VE
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_first", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":383
+ /* "cdec/sa/veb.pxi":383
*
* cdef int _first(self):
* return self.veb.min_val # <<<<<<<<<<<<<<
@@ -23216,7 +24448,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VE
__pyx_r = __pyx_v_self->veb->min_val;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":382
+ /* "cdec/sa/veb.pxi":382
* return VEB_findsucc(self.veb, i)
*
* cdef int _first(self): # <<<<<<<<<<<<<<
@@ -23230,7 +24462,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VE
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":385
+/* "cdec/sa/veb.pxi":385
* return self.veb.min_val
*
* cdef int _findsucc(self, int i): # <<<<<<<<<<<<<<
@@ -23243,7 +24475,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__findsucc(struct __pyx_obj_4cdec_2sa_3_sa
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_findsucc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":386
+ /* "cdec/sa/veb.pxi":386
*
* cdef int _findsucc(self, int i):
* return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<<
@@ -23253,7 +24485,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__findsucc(struct __pyx_obj_4cdec_2sa_3_sa
__pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":385
+ /* "cdec/sa/veb.pxi":385
* return self.veb.min_val
*
* cdef int _findsucc(self, int i): # <<<<<<<<<<<<<<
@@ -23267,7 +24499,7 @@ static int __pyx_f_4cdec_2sa_3_sa_3VEB__findsucc(struct __pyx_obj_4cdec_2sa_3_sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":388
+/* "cdec/sa/veb.pxi":388
* return VEB_findsucc(self.veb, i)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -23293,7 +24525,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":389
+ /* "cdec/sa/veb.pxi":389
*
* def __len__(self):
* return self.veb.size # <<<<<<<<<<<<<<
@@ -23303,7 +24535,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_self->veb->size;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":388
+ /* "cdec/sa/veb.pxi":388
* return VEB_findsucc(self.veb, i)
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -23317,7 +24549,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":391
+/* "cdec/sa/veb.pxi":391
* return self.veb.size
*
* def __contains__(self, i): # <<<<<<<<<<<<<<
@@ -23346,7 +24578,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__contains__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":392
+ /* "cdec/sa/veb.pxi":392
*
* def __contains__(self, i):
* return VEB_contains(self.veb, i) # <<<<<<<<<<<<<<
@@ -23355,7 +24587,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2s
__pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":391
+ /* "cdec/sa/veb.pxi":391
* return self.veb.size
*
* def __contains__(self, i): # <<<<<<<<<<<<<<
@@ -23371,7 +24603,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":9
+/* "cdec/sa/lcp.pxi":9
* cdef IntList lcp
*
* def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<<
@@ -23450,14 +24682,12 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
int __pyx_t_3;
int __pyx_t_4;
int __pyx_t_5;
- int __pyx_t_6;
- int __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13
+ /* "cdec/sa/lcp.pxi":13
* cdef IntList rank
*
* logger.info("Constructing LCP array") # <<<<<<<<<<<<<<
@@ -23474,7 +24704,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":14
+ /* "cdec/sa/lcp.pxi":14
*
* logger.info("Constructing LCP array")
* self.sa = sa # <<<<<<<<<<<<<<
@@ -23487,7 +24717,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_DECREF(((PyObject *)__pyx_v_self->sa));
__pyx_v_self->sa = __pyx_v_sa;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":15
+ /* "cdec/sa/lcp.pxi":15
* logger.info("Constructing LCP array")
* self.sa = sa
* n = self.sa.sa.len # <<<<<<<<<<<<<<
@@ -23497,7 +24727,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_t_3 = __pyx_v_self->sa->sa->len;
__pyx_v_n = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":16
+ /* "cdec/sa/lcp.pxi":16
* self.sa = sa
* n = self.sa.sa.len
* self.lcp = IntList(initial_len=n) # <<<<<<<<<<<<<<
@@ -23519,7 +24749,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_v_self->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":18
+ /* "cdec/sa/lcp.pxi":18
* self.lcp = IntList(initial_len=n)
*
* rank = IntList(initial_len=n) # <<<<<<<<<<<<<<
@@ -23538,7 +24768,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_v_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":19
+ /* "cdec/sa/lcp.pxi":19
*
* rank = IntList(initial_len=n)
* for i from 0 <= i < n: # <<<<<<<<<<<<<<
@@ -23548,7 +24778,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_t_3 = __pyx_v_n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":20
+ /* "cdec/sa/lcp.pxi":20
* rank = IntList(initial_len=n)
* for i from 0 <= i < n:
* rank.arr[sa.sa.arr[i]] = i # <<<<<<<<<<<<<<
@@ -23558,7 +24788,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
(__pyx_v_rank->arr[(__pyx_v_sa->sa->arr[__pyx_v_i])]) = __pyx_v_i;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":22
+ /* "cdec/sa/lcp.pxi":22
* rank.arr[sa.sa.arr[i]] = i
*
* h = 0 # <<<<<<<<<<<<<<
@@ -23567,7 +24797,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
*/
__pyx_v_h = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":23
+ /* "cdec/sa/lcp.pxi":23
*
* h = 0
* for i from 0 <= i < n: # <<<<<<<<<<<<<<
@@ -23577,7 +24807,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_t_3 = __pyx_v_n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":24
+ /* "cdec/sa/lcp.pxi":24
* h = 0
* for i from 0 <= i < n:
* k = rank.arr[i] # <<<<<<<<<<<<<<
@@ -23586,7 +24816,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
*/
__pyx_v_k = (__pyx_v_rank->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":25
+ /* "cdec/sa/lcp.pxi":25
* for i from 0 <= i < n:
* k = rank.arr[i]
* if k == 0: # <<<<<<<<<<<<<<
@@ -23596,7 +24826,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_t_4 = ((__pyx_v_k == 0) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":26
+ /* "cdec/sa/lcp.pxi":26
* k = rank.arr[i]
* if k == 0:
* self.lcp.arr[k] = -1 # <<<<<<<<<<<<<<
@@ -23608,7 +24838,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":28
+ /* "cdec/sa/lcp.pxi":28
* self.lcp.arr[k] = -1
* else:
* j = sa.sa.arr[k-1] # <<<<<<<<<<<<<<
@@ -23617,7 +24847,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
*/
__pyx_v_j = (__pyx_v_sa->sa->arr[(__pyx_v_k - 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":29
+ /* "cdec/sa/lcp.pxi":29
* else:
* j = sa.sa.arr[k-1]
* while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]: # <<<<<<<<<<<<<<
@@ -23625,22 +24855,28 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
* self.lcp.arr[k] = h
*/
while (1) {
- __pyx_t_4 = (((__pyx_v_i + __pyx_v_h) < __pyx_v_n) != 0);
- if (__pyx_t_4) {
- __pyx_t_5 = (((__pyx_v_j + __pyx_v_h) < __pyx_v_n) != 0);
- if (__pyx_t_5) {
- __pyx_t_6 = (((__pyx_v_sa->darray->data->arr[(__pyx_v_i + __pyx_v_h)]) == (__pyx_v_sa->darray->data->arr[(__pyx_v_j + __pyx_v_h)])) != 0);
- __pyx_t_7 = __pyx_t_6;
- } else {
- __pyx_t_7 = __pyx_t_5;
- }
- __pyx_t_5 = __pyx_t_7;
+ __pyx_t_5 = (((__pyx_v_i + __pyx_v_h) < __pyx_v_n) != 0);
+ if (__pyx_t_5) {
+ goto __pyx_L11_next_and;
} else {
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = __pyx_t_5;
+ goto __pyx_L10_bool_binop_done;
}
- if (!__pyx_t_5) break;
+ __pyx_L11_next_and:;
+ __pyx_t_5 = (((__pyx_v_j + __pyx_v_h) < __pyx_v_n) != 0);
+ if (__pyx_t_5) {
+ goto __pyx_L12_next_and;
+ } else {
+ __pyx_t_4 = __pyx_t_5;
+ goto __pyx_L10_bool_binop_done;
+ }
+ __pyx_L12_next_and:;
+ __pyx_t_5 = (((__pyx_v_sa->darray->data->arr[(__pyx_v_i + __pyx_v_h)]) == (__pyx_v_sa->darray->data->arr[(__pyx_v_j + __pyx_v_h)])) != 0);
+ __pyx_t_4 = __pyx_t_5;
+ __pyx_L10_bool_binop_done:;
+ if (!__pyx_t_4) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":30
+ /* "cdec/sa/lcp.pxi":30
* j = sa.sa.arr[k-1]
* while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]:
* h = h+1 # <<<<<<<<<<<<<<
@@ -23650,7 +24886,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__pyx_v_h = (__pyx_v_h + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":31
+ /* "cdec/sa/lcp.pxi":31
* while i+h < n and j+h < n and sa.darray.data.arr[i+h] == sa.darray.data.arr[j+h]:
* h = h+1
* self.lcp.arr[k] = h # <<<<<<<<<<<<<<
@@ -23661,17 +24897,17 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
}
__pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":32
+ /* "cdec/sa/lcp.pxi":32
* h = h+1
* self.lcp.arr[k] = h
* if h > 0: # <<<<<<<<<<<<<<
* h = h-1
* logger.info("LCP array completed")
*/
- __pyx_t_5 = ((__pyx_v_h > 0) != 0);
- if (__pyx_t_5) {
+ __pyx_t_4 = ((__pyx_v_h > 0) != 0);
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":33
+ /* "cdec/sa/lcp.pxi":33
* self.lcp.arr[k] = h
* if h > 0:
* h = h-1 # <<<<<<<<<<<<<<
@@ -23679,12 +24915,12 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
*
*/
__pyx_v_h = (__pyx_v_h - 1);
- goto __pyx_L10;
+ goto __pyx_L13;
}
- __pyx_L10:;
+ __pyx_L13:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34
+ /* "cdec/sa/lcp.pxi":34
* if h > 0:
* h = h-1
* logger.info("LCP array completed") # <<<<<<<<<<<<<<
@@ -23701,7 +24937,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":9
+ /* "cdec/sa/lcp.pxi":9
* cdef IntList lcp
*
* def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<<
@@ -23724,7 +24960,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_s
}
static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36
+/* "cdec/sa/lcp.pxi":36
* logger.info("LCP array completed")
*
* def compute_stats(self, int max_n): # <<<<<<<<<<<<<<
@@ -23778,19 +25014,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4c
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__pyx_cur_scope->__pyx_v_max_n = __pyx_v_max_n;
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_compute_stats, __pyx_n_s_LCP_compute_stats); if (unlikely(!gen)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -23808,9 +25041,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
- int __pyx_t_8;
- long __pyx_t_9;
- PyObject *__pyx_t_10 = NULL;
+ long __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -23818,7 +25050,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_RefNannySetupContext("None", 0);
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
- case 1: goto __pyx_L26_resume_from_yield;
+ case 1: goto __pyx_L29_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -23826,7 +25058,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":48
+ /* "cdec/sa/lcp.pxi":48
* cdef VEB veb
*
* N = self.sa.sa.len # <<<<<<<<<<<<<<
@@ -23836,7 +25068,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_self->sa->sa->len;
__pyx_cur_scope->__pyx_v_N = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":50
+ /* "cdec/sa/lcp.pxi":50
* N = self.sa.sa.len
*
* ngram_starts = [] # <<<<<<<<<<<<<<
@@ -23849,7 +25081,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_ngram_starts = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":51
+ /* "cdec/sa/lcp.pxi":51
*
* ngram_starts = []
* for n from 0 <= n < max_n: # <<<<<<<<<<<<<<
@@ -23859,7 +25091,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_max_n;
for (__pyx_cur_scope->__pyx_v_n = 0; __pyx_cur_scope->__pyx_v_n < __pyx_t_1; __pyx_cur_scope->__pyx_v_n++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":52
+ /* "cdec/sa/lcp.pxi":52
* ngram_starts = []
* for n from 0 <= n < max_n:
* ngram_starts.append(IntList(initial_len=N)) # <<<<<<<<<<<<<<
@@ -23879,7 +25111,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":54
+ /* "cdec/sa/lcp.pxi":54
* ngram_starts.append(IntList(initial_len=N))
*
* run_start = IntList(initial_len=max_n) # <<<<<<<<<<<<<<
@@ -23899,7 +25131,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":55
+ /* "cdec/sa/lcp.pxi":55
*
* run_start = IntList(initial_len=max_n)
* veb = VEB(N) # <<<<<<<<<<<<<<
@@ -23920,7 +25152,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":57
+ /* "cdec/sa/lcp.pxi":57
* veb = VEB(N)
*
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
@@ -23930,7 +25162,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_N;
for (__pyx_cur_scope->__pyx_v_i = 0; __pyx_cur_scope->__pyx_v_i < __pyx_t_1; __pyx_cur_scope->__pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":58
+ /* "cdec/sa/lcp.pxi":58
*
* for i from 0 <= i < N:
* h = self.lcp.arr[i] # <<<<<<<<<<<<<<
@@ -23939,7 +25171,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_h = (__pyx_cur_scope->__pyx_v_self->lcp->arr[__pyx_cur_scope->__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":59
+ /* "cdec/sa/lcp.pxi":59
* for i from 0 <= i < N:
* h = self.lcp.arr[i]
* if h < 0: # <<<<<<<<<<<<<<
@@ -23949,7 +25181,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_5 = ((__pyx_cur_scope->__pyx_v_h < 0) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":60
+ /* "cdec/sa/lcp.pxi":60
* h = self.lcp.arr[i]
* if h < 0:
* h = 0 # <<<<<<<<<<<<<<
@@ -23961,7 +25193,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
}
__pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":61
+ /* "cdec/sa/lcp.pxi":61
* if h < 0:
* h = 0
* for n from h <= n < max_n: # <<<<<<<<<<<<<<
@@ -23971,7 +25203,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_6 = __pyx_cur_scope->__pyx_v_max_n;
for (__pyx_cur_scope->__pyx_v_n = __pyx_cur_scope->__pyx_v_h; __pyx_cur_scope->__pyx_v_n < __pyx_t_6; __pyx_cur_scope->__pyx_v_n++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":62
+ /* "cdec/sa/lcp.pxi":62
* h = 0
* for n from h <= n < max_n:
* rs = run_start.arr[n] # <<<<<<<<<<<<<<
@@ -23980,7 +25212,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":63
+ /* "cdec/sa/lcp.pxi":63
* for n from h <= n < max_n:
* rs = run_start.arr[n]
* run_start.arr[n] = i # <<<<<<<<<<<<<<
@@ -23989,7 +25221,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
(__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]) = __pyx_cur_scope->__pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":64
+ /* "cdec/sa/lcp.pxi":64
* rs = run_start.arr[n]
* run_start.arr[n] = i
* freq = i - rs # <<<<<<<<<<<<<<
@@ -23998,7 +25230,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_rs);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":65
+ /* "cdec/sa/lcp.pxi":65
* run_start.arr[n] = i
* freq = i - rs
* if freq > 1000: # arbitrary, but see note below # <<<<<<<<<<<<<<
@@ -24008,7 +25240,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_5 = ((__pyx_cur_scope->__pyx_v_freq > 1000) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":66
+ /* "cdec/sa/lcp.pxi":66
* freq = i - rs
* if freq > 1000: # arbitrary, but see note below
* veb._insert(freq) # <<<<<<<<<<<<<<
@@ -24017,7 +25249,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_insert(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_freq);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":67
+ /* "cdec/sa/lcp.pxi":67
* if freq > 1000: # arbitrary, but see note below
* veb._insert(freq)
* ngram_start = ngram_starts[n] # <<<<<<<<<<<<<<
@@ -24032,7 +25264,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":68
+ /* "cdec/sa/lcp.pxi":68
* veb._insert(freq)
* ngram_start = ngram_starts[n]
* while ngram_start.arr[freq] > 0: # <<<<<<<<<<<<<<
@@ -24043,7 +25275,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_5 = (((__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) > 0) != 0);
if (!__pyx_t_5) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":69
+ /* "cdec/sa/lcp.pxi":69
* ngram_start = ngram_starts[n]
* while ngram_start.arr[freq] > 0:
* freq = freq + 1 # cheating a bit, should be ok for sparse histogram # <<<<<<<<<<<<<<
@@ -24053,7 +25285,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_freq + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":70
+ /* "cdec/sa/lcp.pxi":70
* while ngram_start.arr[freq] > 0:
* freq = freq + 1 # cheating a bit, should be ok for sparse histogram
* ngram_start.arr[freq] = rs # <<<<<<<<<<<<<<
@@ -24067,7 +25299,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":71
+ /* "cdec/sa/lcp.pxi":71
* freq = freq + 1 # cheating a bit, should be ok for sparse histogram
* ngram_start.arr[freq] = rs
* i = veb.veb.min_val # <<<<<<<<<<<<<<
@@ -24077,7 +25309,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_veb->veb->min_val;
__pyx_cur_scope->__pyx_v_i = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":72
+ /* "cdec/sa/lcp.pxi":72
* ngram_start.arr[freq] = rs
* i = veb.veb.min_val
* while i != -1: # <<<<<<<<<<<<<<
@@ -24088,7 +25320,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_5 = ((__pyx_cur_scope->__pyx_v_i != -1) != 0);
if (!__pyx_t_5) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":73
+ /* "cdec/sa/lcp.pxi":73
* i = veb.veb.min_val
* while i != -1:
* ii = veb._findsucc(i) # <<<<<<<<<<<<<<
@@ -24097,7 +25329,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_ii = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":74
+ /* "cdec/sa/lcp.pxi":74
* while i != -1:
* ii = veb._findsucc(i)
* for n from 0 <= n < max_n: # <<<<<<<<<<<<<<
@@ -24107,7 +25339,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_t_1 = __pyx_cur_scope->__pyx_v_max_n;
for (__pyx_cur_scope->__pyx_v_n = 0; __pyx_cur_scope->__pyx_v_n < __pyx_t_1; __pyx_cur_scope->__pyx_v_n++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":75
+ /* "cdec/sa/lcp.pxi":75
* ii = veb._findsucc(i)
* for n from 0 <= n < max_n:
* ngram_start = ngram_starts[n] # <<<<<<<<<<<<<<
@@ -24122,7 +25354,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":76
+ /* "cdec/sa/lcp.pxi":76
* for n from 0 <= n < max_n:
* ngram_start = ngram_starts[n]
* iii = i # <<<<<<<<<<<<<<
@@ -24131,7 +25363,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_iii = __pyx_cur_scope->__pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":77
+ /* "cdec/sa/lcp.pxi":77
* ngram_start = ngram_starts[n]
* iii = i
* rs = ngram_start.arr[iii] # <<<<<<<<<<<<<<
@@ -24140,7 +25372,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":78
+ /* "cdec/sa/lcp.pxi":78
* iii = i
* rs = ngram_start.arr[iii]
* while (ii==-1 or iii < ii) and rs != 0: # <<<<<<<<<<<<<<
@@ -24148,22 +25380,27 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
* valid = 1
*/
while (1) {
- __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_ii == -1) != 0);
- if (!__pyx_t_5) {
- __pyx_t_7 = ((__pyx_cur_scope->__pyx_v_iii < __pyx_cur_scope->__pyx_v_ii) != 0);
- __pyx_t_8 = __pyx_t_7;
+ __pyx_t_7 = ((__pyx_cur_scope->__pyx_v_ii == -1) != 0);
+ if (!__pyx_t_7) {
+ goto __pyx_L22_next_or;
} else {
- __pyx_t_8 = __pyx_t_5;
+ goto __pyx_L21_next_and;
}
- if (__pyx_t_8) {
- __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_rs != 0) != 0);
- __pyx_t_7 = __pyx_t_5;
+ __pyx_L22_next_or:;
+ __pyx_t_7 = ((__pyx_cur_scope->__pyx_v_iii < __pyx_cur_scope->__pyx_v_ii) != 0);
+ if (__pyx_t_7) {
+ goto __pyx_L21_next_and;
} else {
- __pyx_t_7 = __pyx_t_8;
+ __pyx_t_5 = __pyx_t_7;
+ goto __pyx_L20_bool_binop_done;
}
- if (!__pyx_t_7) break;
+ __pyx_L21_next_and:;
+ __pyx_t_7 = ((__pyx_cur_scope->__pyx_v_rs != 0) != 0);
+ __pyx_t_5 = __pyx_t_7;
+ __pyx_L20_bool_binop_done:;
+ if (!__pyx_t_5) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":79
+ /* "cdec/sa/lcp.pxi":79
* rs = ngram_start.arr[iii]
* while (ii==-1 or iii < ii) and rs != 0:
* j = self.sa.sa.arr[rs] # <<<<<<<<<<<<<<
@@ -24172,7 +25409,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_self->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":80
+ /* "cdec/sa/lcp.pxi":80
* while (ii==-1 or iii < ii) and rs != 0:
* j = self.sa.sa.arr[rs]
* valid = 1 # <<<<<<<<<<<<<<
@@ -24181,27 +25418,27 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_valid = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":81
+ /* "cdec/sa/lcp.pxi":81
* j = self.sa.sa.arr[rs]
* valid = 1
* for k from 0 <= k < n+1: # <<<<<<<<<<<<<<
* if self.sa.darray.data.arr[j+k] < 2:
* valid = 0
*/
- __pyx_t_9 = (__pyx_cur_scope->__pyx_v_n + 1);
- for (__pyx_cur_scope->__pyx_v_k = 0; __pyx_cur_scope->__pyx_v_k < __pyx_t_9; __pyx_cur_scope->__pyx_v_k++) {
+ __pyx_t_8 = (__pyx_cur_scope->__pyx_v_n + 1);
+ for (__pyx_cur_scope->__pyx_v_k = 0; __pyx_cur_scope->__pyx_v_k < __pyx_t_8; __pyx_cur_scope->__pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":82
+ /* "cdec/sa/lcp.pxi":82
* valid = 1
* for k from 0 <= k < n+1:
* if self.sa.darray.data.arr[j+k] < 2: # <<<<<<<<<<<<<<
* valid = 0
* if valid:
*/
- __pyx_t_7 = (((__pyx_cur_scope->__pyx_v_self->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)]) < 2) != 0);
- if (__pyx_t_7) {
+ __pyx_t_5 = (((__pyx_cur_scope->__pyx_v_self->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)]) < 2) != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":83
+ /* "cdec/sa/lcp.pxi":83
* for k from 0 <= k < n+1:
* if self.sa.darray.data.arr[j+k] < 2:
* valid = 0 # <<<<<<<<<<<<<<
@@ -24209,22 +25446,22 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
* ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)])
*/
__pyx_cur_scope->__pyx_v_valid = 0;
- goto __pyx_L22;
+ goto __pyx_L25;
}
- __pyx_L22:;
+ __pyx_L25:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":84
+ /* "cdec/sa/lcp.pxi":84
* if self.sa.darray.data.arr[j+k] < 2:
* valid = 0
* if valid: # <<<<<<<<<<<<<<
* ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)])
* yield i, n+1, ngram
*/
- __pyx_t_7 = (__pyx_cur_scope->__pyx_v_valid != 0);
- if (__pyx_t_7) {
+ __pyx_t_5 = (__pyx_cur_scope->__pyx_v_valid != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":85
+ /* "cdec/sa/lcp.pxi":85
* valid = 0
* if valid:
* ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) # <<<<<<<<<<<<<<
@@ -24233,8 +25470,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = (__pyx_cur_scope->__pyx_v_n + 1);
- for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_9; __pyx_t_6+=1) {
+ __pyx_t_8 = (__pyx_cur_scope->__pyx_v_n + 1);
+ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
__pyx_cur_scope->__pyx_v_k = __pyx_t_6;
__pyx_t_3 = __Pyx_PyInt_From_int((__pyx_cur_scope->__pyx_v_self->sa->darray->data->arr[(__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_k)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -24249,7 +25486,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":86
+ /* "cdec/sa/lcp.pxi":86
* if valid:
* ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)])
* yield i, n+1, ngram # <<<<<<<<<<<<<<
@@ -24260,33 +25497,33 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_n + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
+ __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_ngram);
- PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_cur_scope->__pyx_v_ngram);
+ PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_cur_scope->__pyx_v_ngram);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ngram);
__pyx_t_3 = 0;
__pyx_t_2 = 0;
- __pyx_r = __pyx_t_10;
- __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_9;
+ __pyx_t_9 = 0;
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
- __pyx_L26_resume_from_yield:;
+ __pyx_L29_resume_from_yield:;
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L23;
+ goto __pyx_L26;
}
- __pyx_L23:;
+ __pyx_L26:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":87
+ /* "cdec/sa/lcp.pxi":87
* ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)])
* yield i, n+1, ngram
* iii = iii + 1 # <<<<<<<<<<<<<<
@@ -24295,7 +25532,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
*/
__pyx_cur_scope->__pyx_v_iii = (__pyx_cur_scope->__pyx_v_iii + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":88
+ /* "cdec/sa/lcp.pxi":88
* yield i, n+1, ngram
* iii = iii + 1
* rs = ngram_start.arr[iii] # <<<<<<<<<<<<<<
@@ -24305,7 +25542,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":89
+ /* "cdec/sa/lcp.pxi":89
* iii = iii + 1
* rs = ngram_start.arr[iii]
* i = ii # <<<<<<<<<<<<<<
@@ -24313,7 +25550,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_cur_scope->__pyx_v_i = __pyx_cur_scope->__pyx_v_ii;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36
+ /* "cdec/sa/lcp.pxi":36
* logger.info("LCP array completed")
*
* def compute_stats(self, int max_n): # <<<<<<<<<<<<<<
@@ -24327,7 +25564,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -24337,7 +25574,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":12
+/* "cdec/sa/sym.pxi":12
* cdef dict id2sym
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -24370,7 +25607,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":13
+ /* "cdec/sa/sym.pxi":13
*
* def __cinit__(self):
* self.terminals = StringMap() # <<<<<<<<<<<<<<
@@ -24385,7 +25622,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
__pyx_v_self->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":14
+ /* "cdec/sa/sym.pxi":14
* def __cinit__(self):
* self.terminals = StringMap()
* self.nonterminals = StringMap() # <<<<<<<<<<<<<<
@@ -24400,7 +25637,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
__pyx_v_self->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":15
+ /* "cdec/sa/sym.pxi":15
* self.terminals = StringMap()
* self.nonterminals = StringMap()
* self.id2sym = {} # <<<<<<<<<<<<<<
@@ -24415,7 +25652,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
__pyx_v_self->id2sym = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":16
+ /* "cdec/sa/sym.pxi":16
* self.nonterminals = StringMap()
* self.id2sym = {}
* self.first_nonterminal = -1 # <<<<<<<<<<<<<<
@@ -24424,7 +25661,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
*/
__pyx_v_self->first_nonterminal = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":12
+ /* "cdec/sa/sym.pxi":12
* cdef dict id2sym
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -24444,7 +25681,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":18
+/* "cdec/sa/sym.pxi":18
* self.first_nonterminal = -1
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -24471,7 +25708,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":21
+/* "cdec/sa/sym.pxi":21
* pass
*
* cdef int isvar(self, int sym): # <<<<<<<<<<<<<<
@@ -24484,7 +25721,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("isvar", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":22
+ /* "cdec/sa/sym.pxi":22
*
* cdef int isvar(self, int sym):
* return sym < 0 # <<<<<<<<<<<<<<
@@ -24494,7 +25731,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj
__pyx_r = (__pyx_v_sym < 0);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":21
+ /* "cdec/sa/sym.pxi":21
* pass
*
* cdef int isvar(self, int sym): # <<<<<<<<<<<<<<
@@ -24508,7 +25745,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":24
+/* "cdec/sa/sym.pxi":24
* return sym < 0
*
* cdef int isword(self, int sym): # <<<<<<<<<<<<<<
@@ -24521,7 +25758,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_ob
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("isword", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":25
+ /* "cdec/sa/sym.pxi":25
*
* cdef int isword(self, int sym):
* return sym >= 0 # <<<<<<<<<<<<<<
@@ -24531,7 +25768,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_ob
__pyx_r = (__pyx_v_sym >= 0);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":24
+ /* "cdec/sa/sym.pxi":24
* return sym < 0
*
* cdef int isword(self, int sym): # <<<<<<<<<<<<<<
@@ -24545,7 +25782,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":27
+/* "cdec/sa/sym.pxi":27
* return sym >= 0
*
* cdef int getindex(self, int sym): # <<<<<<<<<<<<<<
@@ -24558,7 +25795,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("getindex", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":28
+ /* "cdec/sa/sym.pxi":28
*
* cdef int getindex(self, int sym):
* return -sym & INDEX_MASK # <<<<<<<<<<<<<<
@@ -24568,7 +25805,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_
__pyx_r = ((-__pyx_v_sym) & __pyx_v_4cdec_2sa_3_sa_INDEX_MASK);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":27
+ /* "cdec/sa/sym.pxi":27
* return sym >= 0
*
* cdef int getindex(self, int sym): # <<<<<<<<<<<<<<
@@ -24582,7 +25819,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":30
+/* "cdec/sa/sym.pxi":30
* return -sym & INDEX_MASK
*
* cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<<
@@ -24595,7 +25832,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("setindex", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":31
+ /* "cdec/sa/sym.pxi":31
*
* cdef int setindex(self, int sym, int ind):
* return -(-sym & ~INDEX_MASK | ind) # <<<<<<<<<<<<<<
@@ -24605,7 +25842,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_
__pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK)) | __pyx_v_ind));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":30
+ /* "cdec/sa/sym.pxi":30
* return -sym & INDEX_MASK
*
* cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<<
@@ -24619,7 +25856,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":33
+/* "cdec/sa/sym.pxi":33
* return -(-sym & ~INDEX_MASK | ind)
*
* cdef int clearindex(self, int sym): # <<<<<<<<<<<<<<
@@ -24632,7 +25869,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clearindex", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":34
+ /* "cdec/sa/sym.pxi":34
*
* cdef int clearindex(self, int sym):
* return -(-sym& ~INDEX_MASK) # <<<<<<<<<<<<<<
@@ -24642,7 +25879,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __py
__pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK)));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":33
+ /* "cdec/sa/sym.pxi":33
* return -(-sym & ~INDEX_MASK | ind)
*
* cdef int clearindex(self, int sym): # <<<<<<<<<<<<<<
@@ -24656,7 +25893,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":36
+/* "cdec/sa/sym.pxi":36
* return -(-sym& ~INDEX_MASK)
*
* cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<<
@@ -24669,7 +25906,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_match(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("match", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":37
+ /* "cdec/sa/sym.pxi":37
*
* cdef int match(self, int sym1, int sym2):
* return self.clearindex(sym1) == self.clearindex(sym2); # <<<<<<<<<<<<<<
@@ -24679,7 +25916,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_match(struct __pyx_obj_4cdec_2sa_3_s
__pyx_r = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym1) == ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym2));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":36
+ /* "cdec/sa/sym.pxi":36
* return -(-sym& ~INDEX_MASK)
*
* cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<<
@@ -24693,7 +25930,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_match(struct __pyx_obj_4cdec_2sa_3_s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":39
+/* "cdec/sa/sym.pxi":39
* return self.clearindex(sym1) == self.clearindex(sym2);
*
* cdef char* tocat(self, int sym): # <<<<<<<<<<<<<<
@@ -24706,7 +25943,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat(struct __pyx_obj_4cdec_2sa_3
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("tocat", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":40
+ /* "cdec/sa/sym.pxi":40
*
* cdef char* tocat(self, int sym):
* return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) # <<<<<<<<<<<<<<
@@ -24716,7 +25953,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat(struct __pyx_obj_4cdec_2sa_3
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->word(__pyx_v_self->nonterminals, (((-__pyx_v_sym) >> __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT) - 1));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":39
+ /* "cdec/sa/sym.pxi":39
* return self.clearindex(sym1) == self.clearindex(sym2);
*
* cdef char* tocat(self, int sym): # <<<<<<<<<<<<<<
@@ -24730,7 +25967,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":42
+/* "cdec/sa/sym.pxi":42
* return self.nonterminals.word((-sym >> INDEX_SHIFT)-1)
*
* cdef int fromcat(self, char *s): # <<<<<<<<<<<<<<
@@ -24745,7 +25982,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
int __pyx_t_1;
__Pyx_RefNannySetupContext("fromcat", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":44
+ /* "cdec/sa/sym.pxi":44
* cdef int fromcat(self, char *s):
* cdef int i
* i = self.nonterminals.index(s) # <<<<<<<<<<<<<<
@@ -24754,7 +25991,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
*/
__pyx_v_i = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->index(__pyx_v_self->nonterminals, __pyx_v_s);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":45
+ /* "cdec/sa/sym.pxi":45
* cdef int i
* i = self.nonterminals.index(s)
* if self.first_nonterminal == -1: # <<<<<<<<<<<<<<
@@ -24764,7 +26001,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
__pyx_t_1 = ((__pyx_v_self->first_nonterminal == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":46
+ /* "cdec/sa/sym.pxi":46
* i = self.nonterminals.index(s)
* if self.first_nonterminal == -1:
* self.first_nonterminal = i # <<<<<<<<<<<<<<
@@ -24776,7 +26013,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":47
+ /* "cdec/sa/sym.pxi":47
* if self.first_nonterminal == -1:
* self.first_nonterminal = i
* if i > self.last_nonterminal: # <<<<<<<<<<<<<<
@@ -24786,7 +26023,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
__pyx_t_1 = ((__pyx_v_i > __pyx_v_self->last_nonterminal) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":48
+ /* "cdec/sa/sym.pxi":48
* self.first_nonterminal = i
* if i > self.last_nonterminal:
* self.last_nonterminal = i # <<<<<<<<<<<<<<
@@ -24798,7 +26035,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":49
+ /* "cdec/sa/sym.pxi":49
* if i > self.last_nonterminal:
* self.last_nonterminal = i
* return -(i+1 << INDEX_SHIFT) # <<<<<<<<<<<<<<
@@ -24808,7 +26045,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
__pyx_r = (-((__pyx_v_i + 1) << __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":42
+ /* "cdec/sa/sym.pxi":42
* return self.nonterminals.word((-sym >> INDEX_SHIFT)-1)
*
* cdef int fromcat(self, char *s): # <<<<<<<<<<<<<<
@@ -24822,7 +26059,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":51
+/* "cdec/sa/sym.pxi":51
* return -(i+1 << INDEX_SHIFT)
*
* cdef char* tostring(self, int sym): # <<<<<<<<<<<<<<
@@ -24845,7 +26082,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("tostring", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":53
+ /* "cdec/sa/sym.pxi":53
* cdef char* tostring(self, int sym):
* cdef int ind
* if self.isvar(sym): # <<<<<<<<<<<<<<
@@ -24855,7 +26092,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
__pyx_t_1 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->isvar(__pyx_v_self, __pyx_v_sym) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":54
+ /* "cdec/sa/sym.pxi":54
* cdef int ind
* if self.isvar(sym):
* if sym in self.id2sym: # <<<<<<<<<<<<<<
@@ -24873,7 +26110,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
__pyx_t_3 = (__pyx_t_1 != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":55
+ /* "cdec/sa/sym.pxi":55
* if self.isvar(sym):
* if sym in self.id2sym:
* return self.id2sym[sym] # <<<<<<<<<<<<<<
@@ -24890,12 +26127,12 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_r = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":56
+ /* "cdec/sa/sym.pxi":56
* if sym in self.id2sym:
* return self.id2sym[sym]
* ind = self.getindex(sym) # <<<<<<<<<<<<<<
@@ -24904,7 +26141,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
*/
__pyx_v_ind = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":57
+ /* "cdec/sa/sym.pxi":57
* return self.id2sym[sym]
* ind = self.getindex(sym)
* if ind > 0: # <<<<<<<<<<<<<<
@@ -24914,7 +26151,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
__pyx_t_3 = ((__pyx_v_ind > 0) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":58
+ /* "cdec/sa/sym.pxi":58
* ind = self.getindex(sym)
* if ind > 0:
* self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) # <<<<<<<<<<<<<<
@@ -24949,7 +26186,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":60
+ /* "cdec/sa/sym.pxi":60
* self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind)
* else:
* self.id2sym[sym] = "[%s]" % self.tocat(sym) # <<<<<<<<<<<<<<
@@ -24973,7 +26210,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":61
+ /* "cdec/sa/sym.pxi":61
* else:
* self.id2sym[sym] = "[%s]" % self.tocat(sym)
* return self.id2sym[sym] # <<<<<<<<<<<<<<
@@ -24990,13 +26227,13 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_5;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L0;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":63
+ /* "cdec/sa/sym.pxi":63
* return self.id2sym[sym]
* else:
* return self.terminals.word(sym) # <<<<<<<<<<<<<<
@@ -25007,7 +26244,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":51
+ /* "cdec/sa/sym.pxi":51
* return -(i+1 << INDEX_SHIFT)
*
* cdef char* tostring(self, int sym): # <<<<<<<<<<<<<<
@@ -25027,7 +26264,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":65
+/* "cdec/sa/sym.pxi":65
* return self.terminals.word(sym)
*
* cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<<
@@ -25044,18 +26281,15 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- int __pyx_t_5;
- PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
- char *__pyx_t_8;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ char *__pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fromstring", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":69
+ /* "cdec/sa/sym.pxi":69
* cdef char *comma
* cdef int n
* n = strlen(s) # <<<<<<<<<<<<<<
@@ -25064,7 +26298,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
__pyx_v_n = strlen(__pyx_v_s);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":71
+ /* "cdec/sa/sym.pxi":71
* n = strlen(s)
* cdef char *sep
* sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<<
@@ -25073,72 +26307,80 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
__pyx_v_sep = strstr(__pyx_v_s, __pyx_k_SEP);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":72
+ /* "cdec/sa/sym.pxi":72
* cdef char *sep
* sep = strstr(s,"_SEP_")
* if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: # <<<<<<<<<<<<<<
* if terminal:
* s1 = "\\"+s
*/
- __pyx_t_1 = ((__pyx_v_n >= 3) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = (((__pyx_v_s[0]) == '[') != 0);
- if (__pyx_t_2) {
- __pyx_t_3 = (((__pyx_v_s[(__pyx_v_n - 1)]) == ']') != 0);
- if (__pyx_t_3) {
- __pyx_t_4 = ((__pyx_v_sep == NULL) != 0);
- __pyx_t_5 = __pyx_t_4;
- } else {
- __pyx_t_5 = __pyx_t_3;
- }
- __pyx_t_3 = __pyx_t_5;
- } else {
- __pyx_t_3 = __pyx_t_2;
- }
- __pyx_t_2 = __pyx_t_3;
+ __pyx_t_2 = ((__pyx_v_n >= 3) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L5_next_and;
} else {
- __pyx_t_2 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_L5_next_and:;
+ __pyx_t_2 = (((__pyx_v_s[0]) == '[') != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L6_next_and;
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
+ __pyx_L6_next_and:;
+ __pyx_t_2 = (((__pyx_v_s[(__pyx_v_n - 1)]) == ']') != 0);
if (__pyx_t_2) {
+ goto __pyx_L7_next_and;
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_L7_next_and:;
+ __pyx_t_2 = ((__pyx_v_sep == NULL) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":73
+ /* "cdec/sa/sym.pxi":73
* sep = strstr(s,"_SEP_")
* if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL:
* if terminal: # <<<<<<<<<<<<<<
* s1 = "\\"+s
* return self.terminals.index(s1)
*/
- __pyx_t_2 = (__pyx_v_terminal != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = (__pyx_v_terminal != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":74
+ /* "cdec/sa/sym.pxi":74
* if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL:
* if terminal:
* s1 = "\\"+s # <<<<<<<<<<<<<<
* return self.terminals.index(s1)
* s[n-1] = c'\0'
*/
- __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyNumber_Add(__pyx_kp_s__45, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_v_s1 = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyNumber_Add(__pyx_kp_s__45, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_s1 = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":75
+ /* "cdec/sa/sym.pxi":75
* if terminal:
* s1 = "\\"+s
* return self.terminals.index(s1) # <<<<<<<<<<<<<<
* s[n-1] = c'\0'
* s = s + 1
*/
- __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_s1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_t_8);
+ __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_s1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_t_5);
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":76
+ /* "cdec/sa/sym.pxi":76
* s1 = "\\"+s
* return self.terminals.index(s1)
* s[n-1] = c'\0' # <<<<<<<<<<<<<<
@@ -25147,7 +26389,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
(__pyx_v_s[(__pyx_v_n - 1)]) = '\x00';
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":77
+ /* "cdec/sa/sym.pxi":77
* return self.terminals.index(s1)
* s[n-1] = c'\0'
* s = s + 1 # <<<<<<<<<<<<<<
@@ -25156,7 +26398,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
__pyx_v_s = (__pyx_v_s + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":78
+ /* "cdec/sa/sym.pxi":78
* s[n-1] = c'\0'
* s = s + 1
* comma = strrchr(s, c',') # <<<<<<<<<<<<<<
@@ -25165,17 +26407,17 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
__pyx_v_comma = strrchr(__pyx_v_s, ',');
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":79
+ /* "cdec/sa/sym.pxi":79
* s = s + 1
* comma = strrchr(s, c',')
* if comma != NULL: # <<<<<<<<<<<<<<
* comma[0] = c'\0'
* return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10))
*/
- __pyx_t_2 = ((__pyx_v_comma != NULL) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_comma != NULL) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":80
+ /* "cdec/sa/sym.pxi":80
* comma = strrchr(s, c',')
* if comma != NULL:
* comma[0] = c'\0' # <<<<<<<<<<<<<<
@@ -25184,7 +26426,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
*/
(__pyx_v_comma[0]) = '\x00';
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":81
+ /* "cdec/sa/sym.pxi":81
* if comma != NULL:
* comma[0] = c'\0'
* return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) # <<<<<<<<<<<<<<
@@ -25196,7 +26438,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":83
+ /* "cdec/sa/sym.pxi":83
* return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10))
* else:
* return self.fromcat(s) # <<<<<<<<<<<<<<
@@ -25209,7 +26451,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":85
+ /* "cdec/sa/sym.pxi":85
* return self.fromcat(s)
* else:
* return self.terminals.index(s) # <<<<<<<<<<<<<<
@@ -25220,7 +26462,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":65
+ /* "cdec/sa/sym.pxi":65
* return self.terminals.word(sym)
*
* cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<<
@@ -25230,8 +26472,8 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
/* function exit code */
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
@@ -25240,7 +26482,7 @@ static int __pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":8
+/* "cdec/sa/sym.pxi":8
*
* cdef class Alphabet:
* cdef readonly StringMap terminals, nonterminals # <<<<<<<<<<<<<<
@@ -25306,7 +26548,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":89
+/* "cdec/sa/sym.pxi":89
* cdef Alphabet ALPHABET = Alphabet()
*
* cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<<
@@ -25319,7 +26561,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_tostring", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":90
+ /* "cdec/sa/sym.pxi":90
*
* cdef char* sym_tostring(int sym):
* return ALPHABET.tostring(sym) # <<<<<<<<<<<<<<
@@ -25329,7 +26571,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) {
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_sym);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":89
+ /* "cdec/sa/sym.pxi":89
* cdef Alphabet ALPHABET = Alphabet()
*
* cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<<
@@ -25343,7 +26585,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) {
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":92
+/* "cdec/sa/sym.pxi":92
* return ALPHABET.tostring(sym)
*
* cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<<
@@ -25356,7 +26598,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_tocat", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":93
+ /* "cdec/sa/sym.pxi":93
*
* cdef char* sym_tocat(int sym):
* return ALPHABET.tocat(sym) # <<<<<<<<<<<<<<
@@ -25366,7 +26608,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) {
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->tocat(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_sym);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":92
+ /* "cdec/sa/sym.pxi":92
* return ALPHABET.tostring(sym)
*
* cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<<
@@ -25380,7 +26622,7 @@ static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) {
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":95
+/* "cdec/sa/sym.pxi":95
* return ALPHABET.tocat(sym)
*
* cdef int sym_isvar(int sym): # <<<<<<<<<<<<<<
@@ -25393,7 +26635,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_isvar", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":96
+ /* "cdec/sa/sym.pxi":96
*
* cdef int sym_isvar(int sym):
* return ALPHABET.isvar(sym) # <<<<<<<<<<<<<<
@@ -25403,7 +26645,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) {
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_sym);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":95
+ /* "cdec/sa/sym.pxi":95
* return ALPHABET.tocat(sym)
*
* cdef int sym_isvar(int sym): # <<<<<<<<<<<<<<
@@ -25417,7 +26659,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) {
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":98
+/* "cdec/sa/sym.pxi":98
* return ALPHABET.isvar(sym)
*
* cdef int sym_getindex(int sym): # <<<<<<<<<<<<<<
@@ -25430,7 +26672,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_getindex", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":99
+ /* "cdec/sa/sym.pxi":99
*
* cdef int sym_getindex(int sym):
* return ALPHABET.getindex(sym) # <<<<<<<<<<<<<<
@@ -25440,7 +26682,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) {
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->getindex(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_sym);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":98
+ /* "cdec/sa/sym.pxi":98
* return ALPHABET.isvar(sym)
*
* cdef int sym_getindex(int sym): # <<<<<<<<<<<<<<
@@ -25454,7 +26696,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) {
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":101
+/* "cdec/sa/sym.pxi":101
* return ALPHABET.getindex(sym)
*
* cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<<
@@ -25467,7 +26709,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_setindex", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":102
+ /* "cdec/sa/sym.pxi":102
*
* cdef int sym_setindex(int sym, int id):
* return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<<
@@ -25477,7 +26719,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id)
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_sym, __pyx_v_id);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":101
+ /* "cdec/sa/sym.pxi":101
* return ALPHABET.getindex(sym)
*
* cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<<
@@ -25491,7 +26733,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id)
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":104
+/* "cdec/sa/sym.pxi":104
* return ALPHABET.setindex(sym, id)
*
* cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<<
@@ -25504,7 +26746,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sym_fromstring", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":105
+ /* "cdec/sa/sym.pxi":105
*
* cdef int sym_fromstring(char* string, bint terminal):
* return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<<
@@ -25514,7 +26756,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx
__pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_4cdec_2sa_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_4cdec_2sa_3_sa_ALPHABET, __pyx_v_string, __pyx_v_terminal);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":104
+ /* "cdec/sa/sym.pxi":104
* return ALPHABET.setindex(sym, id)
*
* cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<<
@@ -25528,7 +26770,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107
+/* "cdec/sa/sym.pxi":107
* return ALPHABET.fromstring(string, terminal)
*
* def isvar(sym): # <<<<<<<<<<<<<<
@@ -25538,7 +26780,7 @@ static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_5isvar = {__Pyx_NAMESTR("isvar"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5isvar, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_5isvar = {"isvar", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5isvar, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -25560,7 +26802,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_se
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("isvar", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":108
+ /* "cdec/sa/sym.pxi":108
*
* def isvar(sym):
* return sym_isvar(sym) # <<<<<<<<<<<<<<
@@ -25575,7 +26817,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_se
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107
+ /* "cdec/sa/sym.pxi":107
* return ALPHABET.fromstring(string, terminal)
*
* def isvar(sym): # <<<<<<<<<<<<<<
@@ -25594,7 +26836,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_se
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+/* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -25604,7 +26846,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_se
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_7make_lattice = {__Pyx_NAMESTR("make_lattice"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7make_lattice, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_7make_lattice = {"make_lattice", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7make_lattice, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -25615,9 +26857,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyO
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111
+/* "cdec/sa/sym.pxi":111
*
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -25643,26 +26885,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator8, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_make_lattice_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -25686,29 +26925,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_Genera
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) { __Pyx_RaiseClosureNameError("words"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_words; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -25763,9 +27004,9 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_Genera
__Pyx_RefNannyFinishContext();
return NULL;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":112
+/* "cdec/sa/sym.pxi":112
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words)
* return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<<
@@ -25791,26 +27032,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator9, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_make_lattice_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -25834,29 +27072,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_Genera
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) { __Pyx_RaiseClosureNameError("word_ids"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_word_ids); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -25926,7 +27166,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_Genera
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+/* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -25954,7 +27194,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *_
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111
+ /* "cdec/sa/sym.pxi":111
*
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -25967,7 +27207,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *_
__pyx_cur_scope->__pyx_v_word_ids = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":112
+ /* "cdec/sa/sym.pxi":112
* def make_lattice(words):
* word_ids = (sym_fromstring(word, True) for word in words)
* return tuple(((word, None, 1), ) for word in word_ids) # <<<<<<<<<<<<<<
@@ -25989,7 +27229,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *_
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+ /* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -26010,7 +27250,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+/* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -26020,7 +27260,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *_
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_9decode_lattice = {__Pyx_NAMESTR("decode_lattice"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9decode_lattice, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_9decode_lattice = {"decode_lattice", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9decode_lattice, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -26031,9 +27271,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, P
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
+/* "cdec/sa/sym.pxi":115
*
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
@@ -26059,26 +27299,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__py
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator10, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_decode_lattice_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.decode_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -26111,7 +27348,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":116
+ /* "cdec/sa/sym.pxi":116
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc
* for arc in node for node in lattice) # <<<<<<<<<<<<<<
@@ -26120,36 +27357,38 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
*/
if (unlikely(!__pyx_cur_scope->__pyx_v_arc)) { __Pyx_RaiseUnboundLocalError("arc"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
+ /* "cdec/sa/sym.pxi":115
*
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
* for arc in node for node in lattice)
*
*/
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_arc) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_arc)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_arc)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_arc)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_v_arc; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_arc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -26232,7 +27471,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":116
+ /* "cdec/sa/sym.pxi":116
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc
* for arc in node for node in lattice) # <<<<<<<<<<<<<<
@@ -26240,29 +27479,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
* def decode_sentence(lattice):
*/
if (unlikely(!__pyx_cur_scope->__pyx_v_node)) { __Pyx_RaiseUnboundLocalError("node"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_node) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_node)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_node)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_node)) {
__pyx_t_4 = __pyx_cur_scope->__pyx_v_node; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0;
__pyx_t_11 = NULL;
} else {
__pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_11)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_7 = __pyx_t_11(__pyx_t_4);
if (unlikely(!__pyx_t_7)) {
@@ -26280,29 +27521,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { __Pyx_RaiseClosureNameError("lattice"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) {
__pyx_t_7 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0;
__pyx_t_13 = NULL;
} else {
__pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext;
+ __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_7)) {
- if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_7)) {
- if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_13)) {
+ if (likely(PyList_CheckExact(__pyx_t_7))) {
+ if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_13(__pyx_t_7);
if (unlikely(!__pyx_t_6)) {
@@ -26320,7 +27563,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
+ /* "cdec/sa/sym.pxi":115
*
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
@@ -26377,10 +27620,26 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
__pyx_t_12 = __pyx_cur_scope->__pyx_t_7;
__pyx_t_13 = __pyx_cur_scope->__pyx_t_8;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/sym.pxi":116
+ * def decode_lattice(lattice):
+ * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc
+ * for arc in node for node in lattice) # <<<<<<<<<<<<<<
+ *
+ * def decode_sentence(lattice):
+ */
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/sym.pxi":115
+ *
+ * def decode_lattice(lattice):
+ * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
+ * for arc in node for node in lattice)
+ *
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -26403,7 +27662,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_Gene
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+/* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -26431,7 +27690,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115
+ /* "cdec/sa/sym.pxi":115
*
* def decode_lattice(lattice):
* return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<<
@@ -26453,7 +27712,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+ /* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -26474,7 +27733,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+/* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -26484,7 +27743,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11decode_sentence = {__Pyx_NAMESTR("decode_sentence"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11decode_sentence, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11decode_sentence = {"decode_sentence", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11decode_sentence, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -26495,9 +27754,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self,
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119
+/* "cdec/sa/sym.pxi":119
*
* def decode_sentence(lattice):
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<<
@@ -26523,26 +27782,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__p
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator11, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_decode_sentence_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.decode_sentence.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -26572,29 +27828,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_Ge
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) { __Pyx_RaiseClosureNameError("lattice"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lattice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -26763,7 +28021,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_Ge
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+/* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -26791,7 +28049,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObjec
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119
+ /* "cdec/sa/sym.pxi":119
*
* def decode_sentence(lattice):
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<<
@@ -26813,7 +28071,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObjec
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+ /* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -26834,7 +28092,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObjec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+/* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -26844,7 +28102,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObjec
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_13encode_words = {__Pyx_NAMESTR("encode_words"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_13encode_words, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_13encode_words = {"encode_words", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_13encode_words, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -26855,9 +28113,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, Py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122
+/* "cdec/sa/sym.pxi":122
*
* def encode_words(words):
* return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -26883,26 +28141,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator12, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_encode_words_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.encode_words.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -26926,29 +28181,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_Gener
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) { __Pyx_RaiseClosureNameError("words"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_words; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_words); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -27004,7 +28261,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_Gener
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+/* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -27032,7 +28289,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122
+ /* "cdec/sa/sym.pxi":122
*
* def encode_words(words):
* return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<<
@@ -27054,7 +28311,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+ /* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -27075,7 +28332,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+/* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -27084,7 +28341,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_15decode_words = {__Pyx_NAMESTR("decode_words"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_15decode_words, METH_O, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_15decode_words = {"decode_words", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_15decode_words, METH_O, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
@@ -27095,9 +28352,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, Py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125
+/* "cdec/sa/sym.pxi":125
*
* def decode_words(syms):
* return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<<
@@ -27121,26 +28378,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator13, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_decode_words_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.decode_words.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
@@ -27164,29 +28418,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_Gener
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms)) { __Pyx_RaiseClosureNameError("syms"); {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_syms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -27242,7 +28498,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_Gener
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+/* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -27269,7 +28525,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_syms);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_syms);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125
+ /* "cdec/sa/sym.pxi":125
*
* def decode_words(syms):
* return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<<
@@ -27289,7 +28545,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+ /* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -27309,7 +28565,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":6
+/* "cdec/sa/rule.pxi":6
* cdef class Phrase:
*
* def __cinit__(self, words): # <<<<<<<<<<<<<<
@@ -27386,7 +28642,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":8
+ /* "cdec/sa/rule.pxi":8
* def __cinit__(self, words):
* cdef int i, j, n, n_vars
* n_vars = 0 # <<<<<<<<<<<<<<
@@ -27395,7 +28651,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_n_vars = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":9
+ /* "cdec/sa/rule.pxi":9
* cdef int i, j, n, n_vars
* n_vars = 0
* n = len(words) # <<<<<<<<<<<<<<
@@ -27405,7 +28661,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_t_1 = PyObject_Length(__pyx_v_words); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_n = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":10
+ /* "cdec/sa/rule.pxi":10
* n_vars = 0
* n = len(words)
* self.syms = <int *>malloc(n*sizeof(int)) # <<<<<<<<<<<<<<
@@ -27414,7 +28670,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":11
+ /* "cdec/sa/rule.pxi":11
* n = len(words)
* self.syms = <int *>malloc(n*sizeof(int))
* for i from 0 <= i < n: # <<<<<<<<<<<<<<
@@ -27424,7 +28680,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_t_2 = __pyx_v_n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":12
+ /* "cdec/sa/rule.pxi":12
* self.syms = <int *>malloc(n*sizeof(int))
* for i from 0 <= i < n:
* self.syms[i] = words[i] # <<<<<<<<<<<<<<
@@ -27437,7 +28693,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
(__pyx_v_self->syms[__pyx_v_i]) = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":13
+ /* "cdec/sa/rule.pxi":13
* for i from 0 <= i < n:
* self.syms[i] = words[i]
* if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<<
@@ -27447,7 +28703,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":14
+ /* "cdec/sa/rule.pxi":14
* self.syms[i] = words[i]
* if sym_isvar(self.syms[i]):
* n_vars += 1 # <<<<<<<<<<<<<<
@@ -27460,7 +28716,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_L5:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":15
+ /* "cdec/sa/rule.pxi":15
* if sym_isvar(self.syms[i]):
* n_vars += 1
* self.n = n # <<<<<<<<<<<<<<
@@ -27469,16 +28725,22 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_self->n = __pyx_v_n;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":16
+ /* "cdec/sa/rule.pxi":16
* n_vars += 1
* self.n = n
* self.n_vars = n_vars # <<<<<<<<<<<<<<
* self.varpos = <int *>malloc(n_vars*sizeof(int))
* j = 0
*/
- __pyx_v_self->n_vars = __pyx_v_n_vars;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_vars); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_v_self->n_vars);
+ __Pyx_DECREF(__pyx_v_self->n_vars);
+ __pyx_v_self->n_vars = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":17
+ /* "cdec/sa/rule.pxi":17
* self.n = n
* self.n_vars = n_vars
* self.varpos = <int *>malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<<
@@ -27487,7 +28749,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":18
+ /* "cdec/sa/rule.pxi":18
* self.n_vars = n_vars
* self.varpos = <int *>malloc(n_vars*sizeof(int))
* j = 0 # <<<<<<<<<<<<<<
@@ -27496,7 +28758,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
__pyx_v_j = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":19
+ /* "cdec/sa/rule.pxi":19
* self.varpos = <int *>malloc(n_vars*sizeof(int))
* j = 0
* for i from 0 <= i < n: # <<<<<<<<<<<<<<
@@ -27506,7 +28768,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_t_2 = __pyx_v_n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":20
+ /* "cdec/sa/rule.pxi":20
* j = 0
* for i from 0 <= i < n:
* if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<<
@@ -27516,7 +28778,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":21
+ /* "cdec/sa/rule.pxi":21
* for i from 0 <= i < n:
* if sym_isvar(self.syms[i]):
* self.varpos[j] = i # <<<<<<<<<<<<<<
@@ -27525,7 +28787,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
*/
(__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":22
+ /* "cdec/sa/rule.pxi":22
* if sym_isvar(self.syms[i]):
* self.varpos[j] = i
* j = j + 1 # <<<<<<<<<<<<<<
@@ -27538,7 +28800,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
__pyx_L8:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":6
+ /* "cdec/sa/rule.pxi":6
* cdef class Phrase:
*
* def __cinit__(self, words): # <<<<<<<<<<<<<<
@@ -27558,7 +28820,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":24
+/* "cdec/sa/rule.pxi":24
* j = j + 1
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -27581,7 +28843,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":25
+ /* "cdec/sa/rule.pxi":25
*
* def __dealloc__(self):
* free(self.syms) # <<<<<<<<<<<<<<
@@ -27590,7 +28852,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_
*/
free(__pyx_v_self->syms);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":26
+ /* "cdec/sa/rule.pxi":26
* def __dealloc__(self):
* free(self.syms)
* free(self.varpos) # <<<<<<<<<<<<<<
@@ -27599,7 +28861,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_
*/
free(__pyx_v_self->varpos);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":24
+ /* "cdec/sa/rule.pxi":24
* j = j + 1
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -27611,7 +28873,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":28
+/* "cdec/sa/rule.pxi":28
* free(self.varpos)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -27646,7 +28908,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":29
+ /* "cdec/sa/rule.pxi":29
*
* def __str__(self):
* strs = [] # <<<<<<<<<<<<<<
@@ -27658,7 +28920,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
__pyx_v_strs = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":31
+ /* "cdec/sa/rule.pxi":31
* strs = []
* cdef int i, s
* for i from 0 <= i < self.n: # <<<<<<<<<<<<<<
@@ -27668,7 +28930,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
__pyx_t_2 = __pyx_v_self->n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":32
+ /* "cdec/sa/rule.pxi":32
* cdef int i, s
* for i from 0 <= i < self.n:
* s = self.syms[i] # <<<<<<<<<<<<<<
@@ -27677,7 +28939,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
*/
__pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":33
+ /* "cdec/sa/rule.pxi":33
* for i from 0 <= i < self.n:
* s = self.syms[i]
* strs.append(sym_tostring(s)) # <<<<<<<<<<<<<<
@@ -27690,7 +28952,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":34
+ /* "cdec/sa/rule.pxi":34
* s = self.syms[i]
* strs.append(sym_tostring(s))
* return ' '.join(strs) # <<<<<<<<<<<<<<
@@ -27704,7 +28966,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":28
+ /* "cdec/sa/rule.pxi":28
* free(self.varpos)
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -27724,7 +28986,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":36
+/* "cdec/sa/rule.pxi":36
* return ' '.join(strs)
*
* def handle(self): # <<<<<<<<<<<<<<
@@ -27762,7 +29024,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("handle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":39
+ /* "cdec/sa/rule.pxi":39
* """return a hashable representation that normalizes the ordering
* of the nonterminal indices"""
* norm = [] # <<<<<<<<<<<<<<
@@ -27774,7 +29036,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
__pyx_v_norm = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":41
+ /* "cdec/sa/rule.pxi":41
* norm = []
* cdef int i, j, s
* i = 1 # <<<<<<<<<<<<<<
@@ -27783,7 +29045,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":42
+ /* "cdec/sa/rule.pxi":42
* cdef int i, j, s
* i = 1
* j = 0 # <<<<<<<<<<<<<<
@@ -27792,7 +29054,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
*/
__pyx_v_j = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":43
+ /* "cdec/sa/rule.pxi":43
* i = 1
* j = 0
* for j from 0 <= j < self.n: # <<<<<<<<<<<<<<
@@ -27802,7 +29064,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
__pyx_t_2 = __pyx_v_self->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":44
+ /* "cdec/sa/rule.pxi":44
* j = 0
* for j from 0 <= j < self.n:
* s = self.syms[j] # <<<<<<<<<<<<<<
@@ -27811,7 +29073,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
*/
__pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":45
+ /* "cdec/sa/rule.pxi":45
* for j from 0 <= j < self.n:
* s = self.syms[j]
* if sym_isvar(s): # <<<<<<<<<<<<<<
@@ -27821,7 +29083,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
__pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":46
+ /* "cdec/sa/rule.pxi":46
* s = self.syms[j]
* if sym_isvar(s):
* s = sym_setindex(s,i) # <<<<<<<<<<<<<<
@@ -27830,7 +29092,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
*/
__pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":47
+ /* "cdec/sa/rule.pxi":47
* if sym_isvar(s):
* s = sym_setindex(s,i)
* i = i + 1 # <<<<<<<<<<<<<<
@@ -27842,7 +29104,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":48
+ /* "cdec/sa/rule.pxi":48
* s = sym_setindex(s,i)
* i = i + 1
* norm.append(s) # <<<<<<<<<<<<<<
@@ -27855,7 +29117,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":49
+ /* "cdec/sa/rule.pxi":49
* i = i + 1
* norm.append(s)
* return tuple(norm) # <<<<<<<<<<<<<<
@@ -27869,7 +29131,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":36
+ /* "cdec/sa/rule.pxi":36
* return ' '.join(strs)
*
* def handle(self): # <<<<<<<<<<<<<<
@@ -27889,7 +29151,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":51
+/* "cdec/sa/rule.pxi":51
* return tuple(norm)
*
* def strhandle(self): # <<<<<<<<<<<<<<
@@ -27926,7 +29188,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("strhandle", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":52
+ /* "cdec/sa/rule.pxi":52
*
* def strhandle(self):
* norm = [] # <<<<<<<<<<<<<<
@@ -27938,7 +29200,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
__pyx_v_norm = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":54
+ /* "cdec/sa/rule.pxi":54
* norm = []
* cdef int i, j, s
* i = 1 # <<<<<<<<<<<<<<
@@ -27947,7 +29209,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":55
+ /* "cdec/sa/rule.pxi":55
* cdef int i, j, s
* i = 1
* j = 0 # <<<<<<<<<<<<<<
@@ -27956,7 +29218,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
*/
__pyx_v_j = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":56
+ /* "cdec/sa/rule.pxi":56
* i = 1
* j = 0
* for j from 0 <= j < self.n: # <<<<<<<<<<<<<<
@@ -27966,7 +29228,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
__pyx_t_2 = __pyx_v_self->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":57
+ /* "cdec/sa/rule.pxi":57
* j = 0
* for j from 0 <= j < self.n:
* s = self.syms[j] # <<<<<<<<<<<<<<
@@ -27975,7 +29237,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
*/
__pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":58
+ /* "cdec/sa/rule.pxi":58
* for j from 0 <= j < self.n:
* s = self.syms[j]
* if sym_isvar(s): # <<<<<<<<<<<<<<
@@ -27985,7 +29247,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
__pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":59
+ /* "cdec/sa/rule.pxi":59
* s = self.syms[j]
* if sym_isvar(s):
* s = sym_setindex(s,i) # <<<<<<<<<<<<<<
@@ -27994,7 +29256,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
*/
__pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":60
+ /* "cdec/sa/rule.pxi":60
* if sym_isvar(s):
* s = sym_setindex(s,i)
* i = i + 1 # <<<<<<<<<<<<<<
@@ -28006,7 +29268,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":61
+ /* "cdec/sa/rule.pxi":61
* s = sym_setindex(s,i)
* i = i + 1
* norm.append(sym_tostring(s)) # <<<<<<<<<<<<<<
@@ -28019,7 +29281,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":62
+ /* "cdec/sa/rule.pxi":62
* i = i + 1
* norm.append(sym_tostring(s))
* return ' '.join(norm) # <<<<<<<<<<<<<<
@@ -28033,7 +29295,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":51
+ /* "cdec/sa/rule.pxi":51
* return tuple(norm)
*
* def strhandle(self): # <<<<<<<<<<<<<<
@@ -28053,7 +29315,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":64
+/* "cdec/sa/rule.pxi":64
* return ' '.join(norm)
*
* def arity(self): # <<<<<<<<<<<<<<
@@ -28077,13 +29339,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self,
static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__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("arity", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":65
+ /* "cdec/sa/rule.pxi":65
*
* def arity(self):
* return self.n_vars # <<<<<<<<<<<<<<
@@ -28091,13 +29349,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(struct __pyx_obj_4cdec_
* def getvarpos(self, i):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_r = __pyx_t_1;
- __pyx_t_1 = 0;
+ __Pyx_INCREF(__pyx_v_self->n_vars);
+ __pyx_r = __pyx_v_self->n_vars;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":64
+ /* "cdec/sa/rule.pxi":64
* return ' '.join(norm)
*
* def arity(self): # <<<<<<<<<<<<<<
@@ -28106,17 +29362,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(struct __pyx_obj_4cdec_
*/
/* function exit code */
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("cdec.sa._sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":67
+/* "cdec/sa/rule.pxi":67
* return self.n_vars
*
* def getvarpos(self, i): # <<<<<<<<<<<<<<
@@ -28141,15 +29393,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- Py_ssize_t __pyx_t_4;
+ int __pyx_t_2;
+ Py_ssize_t __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("getvarpos", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":68
+ /* "cdec/sa/rule.pxi":68
*
* def getvarpos(self, i):
* if 0 <= i < self.n_vars: # <<<<<<<<<<<<<<
@@ -28159,16 +29410,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
__pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
__Pyx_DECREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_self->n_vars, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 68; __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[7]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":69
+ /* "cdec/sa/rule.pxi":69
* def getvarpos(self, i):
* if 0 <= i < self.n_vars:
* return self.varpos[i] # <<<<<<<<<<<<<<
@@ -28176,8 +29424,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
* raise IndexError
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->varpos[__pyx_t_4])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->varpos[__pyx_t_3])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -28185,7 +29433,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":71
+ /* "cdec/sa/rule.pxi":71
* return self.varpos[i]
* else:
* raise IndexError # <<<<<<<<<<<<<<
@@ -28196,7 +29444,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
{__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":67
+ /* "cdec/sa/rule.pxi":67
* return self.n_vars
*
* def getvarpos(self, i): # <<<<<<<<<<<<<<
@@ -28207,7 +29455,6 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cdec.sa._sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -28216,7 +29463,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":73
+/* "cdec/sa/rule.pxi":73
* raise IndexError
*
* def getvar(self, i): # <<<<<<<<<<<<<<
@@ -28241,15 +29488,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- Py_ssize_t __pyx_t_4;
+ int __pyx_t_2;
+ Py_ssize_t __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("getvar", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":74
+ /* "cdec/sa/rule.pxi":74
*
* def getvar(self, i):
* if 0 <= i < self.n_vars: # <<<<<<<<<<<<<<
@@ -28259,16 +29505,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
__pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_i, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
__Pyx_DECREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_self->n_vars, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 74; __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[7]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":75
+ /* "cdec/sa/rule.pxi":75
* def getvar(self, i):
* if 0 <= i < self.n_vars:
* return self.syms[self.varpos[i]] # <<<<<<<<<<<<<<
@@ -28276,8 +29519,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
* raise IndexError
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->syms[(__pyx_v_self->varpos[__pyx_t_4])])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_self->syms[(__pyx_v_self->varpos[__pyx_t_3])])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
@@ -28285,7 +29528,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":77
+ /* "cdec/sa/rule.pxi":77
* return self.syms[self.varpos[i]]
* else:
* raise IndexError # <<<<<<<<<<<<<<
@@ -28296,7 +29539,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
{__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":73
+ /* "cdec/sa/rule.pxi":73
* raise IndexError
*
* def getvar(self, i): # <<<<<<<<<<<<<<
@@ -28307,7 +29550,6 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cdec.sa._sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -28316,7 +29558,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":79
+/* "cdec/sa/rule.pxi":79
* raise IndexError
*
* cdef int chunkpos(self, int k): # <<<<<<<<<<<<<<
@@ -28330,7 +29572,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
int __pyx_t_1;
__Pyx_RefNannySetupContext("chunkpos", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":80
+ /* "cdec/sa/rule.pxi":80
*
* cdef int chunkpos(self, int k):
* if k == 0: # <<<<<<<<<<<<<<
@@ -28340,7 +29582,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
__pyx_t_1 = ((__pyx_v_k == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":81
+ /* "cdec/sa/rule.pxi":81
* cdef int chunkpos(self, int k):
* if k == 0:
* return 0 # <<<<<<<<<<<<<<
@@ -28352,7 +29594,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":83
+ /* "cdec/sa/rule.pxi":83
* return 0
* else:
* return self.varpos[k-1]+1 # <<<<<<<<<<<<<<
@@ -28363,7 +29605,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":79
+ /* "cdec/sa/rule.pxi":79
* raise IndexError
*
* cdef int chunkpos(self, int k): # <<<<<<<<<<<<<<
@@ -28377,7 +29619,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":85
+/* "cdec/sa/rule.pxi":85
* return self.varpos[k-1]+1
*
* cdef int chunklen(self, int k): # <<<<<<<<<<<<<<
@@ -28388,20 +29630,27 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phra
int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) {
int __pyx_r;
__Pyx_RefNannyDeclarations
- int __pyx_t_1;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("chunklen", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":86
+ /* "cdec/sa/rule.pxi":86
*
* cdef int chunklen(self, int k):
* if self.n_vars == 0: # <<<<<<<<<<<<<<
* return self.n
* elif k == 0:
*/
- __pyx_t_1 = ((__pyx_v_self->n_vars == 0) != 0);
- if (__pyx_t_1) {
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->n_vars, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 86; __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[7]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":87
+ /* "cdec/sa/rule.pxi":87
* cdef int chunklen(self, int k):
* if self.n_vars == 0:
* return self.n # <<<<<<<<<<<<<<
@@ -28412,17 +29661,17 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phra
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":88
+ /* "cdec/sa/rule.pxi":88
* if self.n_vars == 0:
* return self.n
* elif k == 0: # <<<<<<<<<<<<<<
* return self.varpos[0]
* elif k == self.n_vars:
*/
- __pyx_t_1 = ((__pyx_v_k == 0) != 0);
- if (__pyx_t_1) {
+ __pyx_t_2 = ((__pyx_v_k == 0) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":89
+ /* "cdec/sa/rule.pxi":89
* return self.n
* elif k == 0:
* return self.varpos[0] # <<<<<<<<<<<<<<
@@ -28433,17 +29682,22 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phra
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":90
+ /* "cdec/sa/rule.pxi":90
* elif k == 0:
* return self.varpos[0]
* elif k == self.n_vars: # <<<<<<<<<<<<<<
* return self.n-self.varpos[k-1]-1
* else:
*/
- __pyx_t_1 = ((__pyx_v_k == __pyx_v_self->n_vars) != 0);
- if (__pyx_t_1) {
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_self->n_vars, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":91
+ /* "cdec/sa/rule.pxi":91
* return self.varpos[0]
* elif k == self.n_vars:
* return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<<
@@ -28455,7 +29709,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phra
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":93
+ /* "cdec/sa/rule.pxi":93
* return self.n-self.varpos[k-1]-1
* else:
* return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<<
@@ -28466,7 +29720,7 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phra
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":85
+ /* "cdec/sa/rule.pxi":85
* return self.varpos[k-1]+1
*
* cdef int chunklen(self, int k): # <<<<<<<<<<<<<<
@@ -28475,12 +29729,17 @@ int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen(struct __pyx_obj_4cdec_2sa_3_sa_Phra
*/
/* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_WriteUnraisable("cdec.sa._sa.Phrase.chunklen", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
+ __pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":95
+/* "cdec/sa/rule.pxi":95
* return self.varpos[k]-self.varpos[k-1]-1
*
* def clen(self, k): # <<<<<<<<<<<<<<
@@ -28511,7 +29770,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("clen", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":96
+ /* "cdec/sa/rule.pxi":96
*
* def clen(self, k):
* return self.chunklen(k) # <<<<<<<<<<<<<<
@@ -28526,7 +29785,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":95
+ /* "cdec/sa/rule.pxi":95
* return self.varpos[k]-self.varpos[k-1]-1
*
* def clen(self, k): # <<<<<<<<<<<<<<
@@ -28545,7 +29804,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":98
+/* "cdec/sa/rule.pxi":98
* return self.chunklen(k)
*
* def getchunk(self, ci): # <<<<<<<<<<<<<<
@@ -28581,7 +29840,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("getchunk", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":100
+ /* "cdec/sa/rule.pxi":100
* def getchunk(self, ci):
* cdef int start, stop
* start = self.chunkpos(ci) # <<<<<<<<<<<<<<
@@ -28591,7 +29850,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ci); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_start = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunkpos(__pyx_v_self, __pyx_t_1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":101
+ /* "cdec/sa/rule.pxi":101
* cdef int start, stop
* start = self.chunkpos(ci)
* stop = start+self.chunklen(ci) # <<<<<<<<<<<<<<
@@ -28601,7 +29860,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ci); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_stop = (__pyx_v_start + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":102
+ /* "cdec/sa/rule.pxi":102
* start = self.chunkpos(ci)
* stop = start+self.chunklen(ci)
* chunk = [] # <<<<<<<<<<<<<<
@@ -28613,7 +29872,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__pyx_v_chunk = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":103
+ /* "cdec/sa/rule.pxi":103
* stop = start+self.chunklen(ci)
* chunk = []
* for i from start <= i < stop: # <<<<<<<<<<<<<<
@@ -28623,7 +29882,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__pyx_t_1 = __pyx_v_stop;
for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":104
+ /* "cdec/sa/rule.pxi":104
* chunk = []
* for i from start <= i < stop:
* chunk.append(self.syms[i]) # <<<<<<<<<<<<<<
@@ -28636,7 +29895,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":105
+ /* "cdec/sa/rule.pxi":105
* for i from start <= i < stop:
* chunk.append(self.syms[i])
* return chunk # <<<<<<<<<<<<<<
@@ -28648,7 +29907,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
__pyx_r = __pyx_v_chunk;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":98
+ /* "cdec/sa/rule.pxi":98
* return self.chunklen(k)
*
* def getchunk(self, ci): # <<<<<<<<<<<<<<
@@ -28668,7 +29927,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":107
+/* "cdec/sa/rule.pxi":107
* return chunk
*
* def __cmp__(self, other): # <<<<<<<<<<<<<<
@@ -28707,7 +29966,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cmp__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":110
+ /* "cdec/sa/rule.pxi":110
* cdef Phrase otherp
* cdef int i
* otherp = other # <<<<<<<<<<<<<<
@@ -28720,7 +29979,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_v_otherp = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":111
+ /* "cdec/sa/rule.pxi":111
* cdef int i
* otherp = other
* for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<<
@@ -28737,7 +29996,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_t_2 = __pyx_t_4;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":112
+ /* "cdec/sa/rule.pxi":112
* otherp = other
* for i from 0 <= i < min(self.n, otherp.n):
* if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<<
@@ -28747,7 +30006,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = (((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":113
+ /* "cdec/sa/rule.pxi":113
* for i from 0 <= i < min(self.n, otherp.n):
* if self.syms[i] < otherp.syms[i]:
* return -1 # <<<<<<<<<<<<<<
@@ -28758,7 +30017,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":114
+ /* "cdec/sa/rule.pxi":114
* if self.syms[i] < otherp.syms[i]:
* return -1
* elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<<
@@ -28768,7 +30027,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = (((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":115
+ /* "cdec/sa/rule.pxi":115
* return -1
* elif self.syms[i] > otherp.syms[i]:
* return 1 # <<<<<<<<<<<<<<
@@ -28780,7 +30039,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":116
+ /* "cdec/sa/rule.pxi":116
* elif self.syms[i] > otherp.syms[i]:
* return 1
* if self.n < otherp.n: # <<<<<<<<<<<<<<
@@ -28790,7 +30049,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = ((__pyx_v_self->n < __pyx_v_otherp->n) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":117
+ /* "cdec/sa/rule.pxi":117
* return 1
* if self.n < otherp.n:
* return -1 # <<<<<<<<<<<<<<
@@ -28801,7 +30060,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":118
+ /* "cdec/sa/rule.pxi":118
* if self.n < otherp.n:
* return -1
* elif self.n > otherp.n: # <<<<<<<<<<<<<<
@@ -28811,7 +30070,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
__pyx_t_5 = ((__pyx_v_self->n > __pyx_v_otherp->n) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":119
+ /* "cdec/sa/rule.pxi":119
* return -1
* elif self.n > otherp.n:
* return 1 # <<<<<<<<<<<<<<
@@ -28823,7 +30082,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":121
+ /* "cdec/sa/rule.pxi":121
* return 1
* else:
* return 0 # <<<<<<<<<<<<<<
@@ -28834,7 +30093,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":107
+ /* "cdec/sa/rule.pxi":107
* return chunk
*
* def __cmp__(self, other): # <<<<<<<<<<<<<<
@@ -28854,7 +30113,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":123
+/* "cdec/sa/rule.pxi":123
* return 0
*
* def __hash__(self): # <<<<<<<<<<<<<<
@@ -28884,7 +30143,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
int __pyx_t_2;
__Pyx_RefNannySetupContext("__hash__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":126
+ /* "cdec/sa/rule.pxi":126
* cdef int i
* cdef unsigned h
* h = 0 # <<<<<<<<<<<<<<
@@ -28893,7 +30152,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
*/
__pyx_v_h = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":127
+ /* "cdec/sa/rule.pxi":127
* cdef unsigned h
* h = 0
* for i from 0 <= i < self.n: # <<<<<<<<<<<<<<
@@ -28903,7 +30162,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
__pyx_t_1 = __pyx_v_self->n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":128
+ /* "cdec/sa/rule.pxi":128
* h = 0
* for i from 0 <= i < self.n:
* if self.syms[i] > 0: # <<<<<<<<<<<<<<
@@ -28913,7 +30172,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
__pyx_t_2 = (((__pyx_v_self->syms[__pyx_v_i]) > 0) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":129
+ /* "cdec/sa/rule.pxi":129
* for i from 0 <= i < self.n:
* if self.syms[i] > 0:
* h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<<
@@ -28925,7 +30184,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":131
+ /* "cdec/sa/rule.pxi":131
* h = (h << 1) + self.syms[i]
* else:
* h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<<
@@ -28937,7 +30196,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
__pyx_L5:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":132
+ /* "cdec/sa/rule.pxi":132
* else:
* h = (h << 1) + -self.syms[i]
* return h # <<<<<<<<<<<<<<
@@ -28947,7 +30206,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
__pyx_r = __pyx_v_h;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":123
+ /* "cdec/sa/rule.pxi":123
* return 0
*
* def __hash__(self): # <<<<<<<<<<<<<<
@@ -28962,7 +30221,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":134
+/* "cdec/sa/rule.pxi":134
* return h
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -28988,7 +30247,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":135
+ /* "cdec/sa/rule.pxi":135
*
* def __len__(self):
* return self.n # <<<<<<<<<<<<<<
@@ -28998,7 +30257,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cd
__pyx_r = __pyx_v_self->n;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":134
+ /* "cdec/sa/rule.pxi":134
* return h
*
* def __len__(self): # <<<<<<<<<<<<<<
@@ -29012,7 +30271,7 @@ static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":137
+/* "cdec/sa/rule.pxi":137
* return self.n
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -29043,7 +30302,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":138
+ /* "cdec/sa/rule.pxi":138
*
* def __getitem__(self, i):
* return self.syms[i] # <<<<<<<<<<<<<<
@@ -29058,7 +30317,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":137
+ /* "cdec/sa/rule.pxi":137
* return self.n
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -29078,7 +30337,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_
}
static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140
+/* "cdec/sa/rule.pxi":140
* return self.syms[i]
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -29117,19 +30376,16 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(struct __pyx_obj_4cd
__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_2sa_3_sa_6Phrase_30generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_Phrase___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.Phrase.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
@@ -29157,7 +30413,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObj
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":142
+ /* "cdec/sa/rule.pxi":142
* def __iter__(self):
* cdef int i
* for i from 0 <= i < self.n: # <<<<<<<<<<<<<<
@@ -29167,7 +30423,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObj
__pyx_t_1 = __pyx_cur_scope->__pyx_v_self->n;
for (__pyx_cur_scope->__pyx_v_i = 0; __pyx_cur_scope->__pyx_v_i < __pyx_t_1; __pyx_cur_scope->__pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":143
+ /* "cdec/sa/rule.pxi":143
* cdef int i
* for i from 0 <= i < self.n:
* yield self.syms[i] # <<<<<<<<<<<<<<
@@ -29189,7 +30445,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObj
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140
+ /* "cdec/sa/rule.pxi":140
* return self.syms[i]
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -29211,7 +30467,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObj
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":145
+/* "cdec/sa/rule.pxi":145
* yield self.syms[i]
*
* def subst(self, start, children): # <<<<<<<<<<<<<<
@@ -29295,7 +30551,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
__Pyx_RefNannySetupContext("subst", 0);
__Pyx_INCREF(__pyx_v_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":147
+ /* "cdec/sa/rule.pxi":147
* def subst(self, start, children):
* cdef int i
* for i from 0 <= i < self.n: # <<<<<<<<<<<<<<
@@ -29305,7 +30561,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
__pyx_t_1 = __pyx_v_self->n;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":148
+ /* "cdec/sa/rule.pxi":148
* cdef int i
* for i from 0 <= i < self.n:
* if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<<
@@ -29315,7 +30571,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
__pyx_t_2 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":149
+ /* "cdec/sa/rule.pxi":149
* for i from 0 <= i < self.n:
* if sym_isvar(self.syms[i]):
* start = start + children[sym_getindex(self.syms[i])-1] # <<<<<<<<<<<<<<
@@ -29334,7 +30590,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":151
+ /* "cdec/sa/rule.pxi":151
* start = start + children[sym_getindex(self.syms[i])-1]
* else:
* start = start + (self.syms[i],) # <<<<<<<<<<<<<<
@@ -29357,7 +30613,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
__pyx_L5:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":152
+ /* "cdec/sa/rule.pxi":152
* else:
* start = start + (self.syms[i],)
* return start # <<<<<<<<<<<<<<
@@ -29369,7 +30625,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_start;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":145
+ /* "cdec/sa/rule.pxi":145
* yield self.syms[i]
*
* def subst(self, start, children): # <<<<<<<<<<<<<<
@@ -29390,7 +30646,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":155
+/* "cdec/sa/rule.pxi":155
*
* property words:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -29427,39 +30683,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":156
+ /* "cdec/sa/rule.pxi":156
* property words:
* def __get__(self):
* return [sym_tostring(w) for w in self if not sym_isvar(w)] # <<<<<<<<<<<<<<
*
- * cdef class Rule:
+ * def iterspans(self, nt_flag = False, to_str = True):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(((PyObject *)__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
__pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
__pyx_t_4 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_5 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_5)) {
@@ -29491,7 +30749,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":155
+ /* "cdec/sa/rule.pxi":155
*
* property words:
* def __get__(self): # <<<<<<<<<<<<<<
@@ -29512,8 +30770,494 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_35generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+
+/* "cdec/sa/rule.pxi":158
+ * return [sym_tostring(w) for w in self if not sym_isvar(w)]
+ *
+ * def iterspans(self, nt_flag = False, to_str = True): # <<<<<<<<<<<<<<
+ * """iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)
+ * Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_34iterspans(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_4cdec_2sa_3_sa_6Phrase_33iterspans[] = "iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)\n Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)\n for the sequence -1 2 3 -1 4 -1";
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_34iterspans(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_nt_flag = 0;
+ PyObject *__pyx_v_to_str = 0;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("iterspans (wrapper)", 0);
+ {
+ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nt_flag,&__pyx_n_s_to_str,0};
+ PyObject* values[2] = {0,0};
+ values[0] = ((PyObject *)Py_False);
+ values[1] = ((PyObject *)Py_True);
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args;
+ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+ switch (pos_args) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = PyDict_Size(__pyx_kwds);
+ switch (pos_args) {
+ case 0:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nt_flag);
+ if (value) { values[0] = value; kw_args--; }
+ }
+ case 1:
+ if (kw_args > 0) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_to_str);
+ if (value) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iterspans") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ } else {
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_nt_flag = values[0];
+ __pyx_v_to_str = values[1];
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("iterspans", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("cdec.sa._sa.Phrase.iterspans", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_33iterspans(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_nt_flag, __pyx_v_to_str);
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "cdec/sa/rule.pxi":164
+ * span = []
+ * cdef int i, s
+ * get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym # <<<<<<<<<<<<<<
+ * for i from 0 <= i < self.n:
+ * s = self.syms[i]
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_sym); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_6Phrase_9iterspans_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_lambda1, METH_O, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_sym) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_sym));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_7lambda1_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_sym); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_6Phrase_9iterspans_7lambda1_lambda2 = {"lambda2", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_7lambda1_lambda2, METH_O, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9iterspans_7lambda1_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_sym) {
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, ((PyObject *)__pyx_v_sym));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("lambda2", 0);
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_sym);
+ __pyx_r = __pyx_v_sym;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":160
+static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_sym) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *__pyx_outer_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("lambda1", 0);
+ __pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_cur_scope = __pyx_outer_scope;
+ __Pyx_XDECREF(__pyx_r);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_to_str)) { __Pyx_RaiseClosureNameError("to_str"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_to_str); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_sym); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_t_4 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_6Phrase_9iterspans_7lambda1_lambda2, 0, __pyx_n_s_iterspans_locals_lambda_locals_l, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_t_4 = 0;
+ }
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("cdec.sa._sa.Phrase.iterspans.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "cdec/sa/rule.pxi":158
+ * return [sym_tostring(w) for w in self if not sym_isvar(w)]
+ *
+ * def iterspans(self, nt_flag = False, to_str = True): # <<<<<<<<<<<<<<
+ * """iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)
+ * Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ */
+
+static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_33iterspans(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_nt_flag, PyObject *__pyx_v_to_str) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *__pyx_cur_scope;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("iterspans", 0);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans, __pyx_empty_tuple, NULL);
+ if (unlikely(!__pyx_cur_scope)) {
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __Pyx_GOTREF(__pyx_cur_scope);
+ __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
+ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
+ __pyx_cur_scope->__pyx_v_nt_flag = __pyx_v_nt_flag;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_nt_flag);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_nt_flag);
+ __pyx_cur_scope->__pyx_v_to_str = __pyx_v_to_str;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_to_str);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_to_str);
+ {
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_6Phrase_35generator3, (PyObject *) __pyx_cur_scope, __pyx_n_s_iterspans, __pyx_n_s_Phrase_iterspans); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_cur_scope);
+ __Pyx_RefNannyFinishContext();
+ return (PyObject *) gen;
+ }
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("cdec.sa._sa.Phrase.iterspans", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_35generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+{
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)__pyx_generator->closure);
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("None", 0);
+ switch (__pyx_generator->resume_label) {
+ case 0: goto __pyx_L3_first_run;
+ case 1: goto __pyx_L8_resume_from_yield;
+ case 2: goto __pyx_L9_resume_from_yield;
+ case 3: goto __pyx_L11_resume_from_yield;
+ default: /* CPython raises the right error here */
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ }
+ __pyx_L3_first_run:;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/rule.pxi":162
+ * Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ * for the sequence -1 2 3 -1 4 -1"""
+ * span = [] # <<<<<<<<<<<<<<
+ * cdef int i, s
+ * get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym
+ */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_span = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "cdec/sa/rule.pxi":164
+ * span = []
+ * cdef int i, s
+ * get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym # <<<<<<<<<<<<<<
+ * for i from 0 <= i < self.n:
+ * s = self.syms[i]
+ */
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_6Phrase_9iterspans_lambda1, 0, __pyx_n_s_iterspans_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_get_sym = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "cdec/sa/rule.pxi":165
+ * cdef int i, s
+ * get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym
+ * for i from 0 <= i < self.n: # <<<<<<<<<<<<<<
+ * s = self.syms[i]
+ * if sym_isvar(s):
+ */
+ __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->n;
+ for (__pyx_cur_scope->__pyx_v_i = 0; __pyx_cur_scope->__pyx_v_i < __pyx_t_2; __pyx_cur_scope->__pyx_v_i++) {
+
+ /* "cdec/sa/rule.pxi":166
+ * get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym
+ * for i from 0 <= i < self.n:
+ * s = self.syms[i] # <<<<<<<<<<<<<<
+ * if sym_isvar(s):
+ * if len(span):
+ */
+ __pyx_cur_scope->__pyx_v_s = (__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i]);
+
+ /* "cdec/sa/rule.pxi":167
+ * for i from 0 <= i < self.n:
+ * s = self.syms[i]
+ * if sym_isvar(s): # <<<<<<<<<<<<<<
+ * if len(span):
+ * yield (span, not nt_flag)
+ */
+ __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_cur_scope->__pyx_v_s) != 0);
+ if (__pyx_t_3) {
+
+ /* "cdec/sa/rule.pxi":168
+ * s = self.syms[i]
+ * if sym_isvar(s):
+ * if len(span): # <<<<<<<<<<<<<<
+ * yield (span, not nt_flag)
+ * span = []
+ */
+ __pyx_t_4 = PyList_GET_SIZE(__pyx_cur_scope->__pyx_v_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "cdec/sa/rule.pxi":169
+ * if sym_isvar(s):
+ * if len(span):
+ * yield (span, not nt_flag) # <<<<<<<<<<<<<<
+ * span = []
+ * yield ([get_sym(s)], nt_flag)
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_nt_flag); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_span);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_span);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_span);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 1;
+ return __pyx_r;
+ __pyx_L8_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/rule.pxi":170
+ * if len(span):
+ * yield (span, not nt_flag)
+ * span = [] # <<<<<<<<<<<<<<
+ * yield ([get_sym(s)], nt_flag)
+ * else:
+ */
+ __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_span);
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_span, ((PyObject*)__pyx_t_5));
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ goto __pyx_L7;
+ }
+ __pyx_L7:;
+
+ /* "cdec/sa/rule.pxi":171
+ * yield (span, not nt_flag)
+ * span = []
+ * yield ([get_sym(s)], nt_flag) # <<<<<<<<<<<<<<
+ * else:
+ * span.append(get_sym(s))
+ */
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_s); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = __pyx_lambda_funcdef_lambda1(__pyx_cur_scope->__pyx_v_get_sym, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_nt_flag);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_nt_flag);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_nt_flag);
+ __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 2;
+ return __pyx_r;
+ __pyx_L9_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L6;
+ }
+ /*else*/ {
+
+ /* "cdec/sa/rule.pxi":173
+ * yield ([get_sym(s)], nt_flag)
+ * else:
+ * span.append(get_sym(s)) # <<<<<<<<<<<<<<
+ * if len(span):
+ * yield (span, not nt_flag)
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __pyx_lambda_funcdef_lambda1(__pyx_cur_scope->__pyx_v_get_sym, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_6 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_span, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __pyx_L6:;
+ }
+
+ /* "cdec/sa/rule.pxi":174
+ * else:
+ * span.append(get_sym(s))
+ * if len(span): # <<<<<<<<<<<<<<
+ * yield (span, not nt_flag)
+ *
+ */
+ __pyx_t_4 = PyList_GET_SIZE(__pyx_cur_scope->__pyx_v_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = (__pyx_t_4 != 0);
+ if (__pyx_t_3) {
+
+ /* "cdec/sa/rule.pxi":175
+ * span.append(get_sym(s))
+ * if len(span):
+ * yield (span, not nt_flag) # <<<<<<<<<<<<<<
+ *
+ * cdef class Rule:
+ */
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_nt_flag); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyBool_FromLong((!__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_span);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_span);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_span);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ /* return from generator, yielding value */
+ __pyx_generator->resume_label = 3;
+ return __pyx_r;
+ __pyx_L11_resume_from_yield:;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ goto __pyx_L10;
+ }
+ __pyx_L10:;
+
+ /* "cdec/sa/rule.pxi":158
+ * return [sym_tostring(w) for w in self if not sym_isvar(w)]
+ *
+ * def iterspans(self, nt_flag = False, to_str = True): # <<<<<<<<<<<<<<
+ * """iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)
+ * Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ */
+
+ /* function exit code */
+ PyErr_SetNone(PyExc_StopIteration);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("iterspans", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_generator->resume_label = -1;
+ __Pyx_Generator_clear((PyObject*)__pyx_generator);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+}
+
+/* "cdec/sa/rule.pxi":179
* cdef class Rule:
*
* def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): # <<<<<<<<<<<<<<
@@ -29560,12 +31304,12 @@ static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyOb
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
@@ -29579,7 +31323,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyOb
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -29592,7 +31336,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyOb
default: goto __pyx_L5_argtuple_error;
}
}
- __pyx_v_lhs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_lhs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_v_lhs = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_lhs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)values[1]);
__pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)values[2]);
__pyx_v_scores = values[3];
@@ -29600,14 +31344,14 @@ static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "e", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "e", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_word_alignments);
/* function exit code */
@@ -29630,7 +31374,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":161
+ /* "cdec/sa/rule.pxi":180
*
* def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None):
* if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) # <<<<<<<<<<<<<<
@@ -29639,25 +31383,25 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
*/
__pyx_t_1 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_lhs) != 0)) != 0);
if (__pyx_t_1) {
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_LHS_symbol_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_LHS_symbol_d, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":162
+ /* "cdec/sa/rule.pxi":181
* def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None):
* if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs)
* self.lhs = lhs # <<<<<<<<<<<<<<
@@ -29666,7 +31410,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
*/
__pyx_v_self->lhs = __pyx_v_lhs;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":163
+ /* "cdec/sa/rule.pxi":182
* if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs)
* self.lhs = lhs
* self.f = f # <<<<<<<<<<<<<<
@@ -29679,7 +31423,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
__Pyx_DECREF(((PyObject *)__pyx_v_self->f));
__pyx_v_self->f = __pyx_v_f;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":164
+ /* "cdec/sa/rule.pxi":183
* self.lhs = lhs
* self.f = f
* self.e = e # <<<<<<<<<<<<<<
@@ -29692,7 +31436,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
__Pyx_DECREF(((PyObject *)__pyx_v_self->e));
__pyx_v_self->e = __pyx_v_e;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":165
+ /* "cdec/sa/rule.pxi":184
* self.f = f
* self.e = e
* self.word_alignments = word_alignments # <<<<<<<<<<<<<<
@@ -29705,14 +31449,14 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
__Pyx_DECREF(__pyx_v_self->word_alignments);
__pyx_v_self->word_alignments = __pyx_v_word_alignments;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":166
+ /* "cdec/sa/rule.pxi":185
* self.e = e
* self.word_alignments = word_alignments
* self.scores = scores # <<<<<<<<<<<<<<
*
* def __hash__(self):
*/
- if (!(likely(((__pyx_v_scores) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_scores, __pyx_ptype_4cdec_2sa_3_sa_FeatureVector))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (!(likely(((__pyx_v_scores) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_scores, __pyx_ptype_4cdec_2sa_3_sa_FeatureVector))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = __pyx_v_scores;
__Pyx_INCREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
@@ -29721,7 +31465,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
__pyx_v_self->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":160
+ /* "cdec/sa/rule.pxi":179
* cdef class Rule:
*
* def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): # <<<<<<<<<<<<<<
@@ -29742,7 +31486,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule___cinit__(struct __pyx_obj_4cdec_2sa_3_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":168
+/* "cdec/sa/rule.pxi":187
* self.scores = scores
*
* def __hash__(self): # <<<<<<<<<<<<<<
@@ -29774,16 +31518,16 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__hash__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":169
+ /* "cdec/sa/rule.pxi":188
*
* def __hash__(self):
* return hash((self.lhs, self.f, self.e)) # <<<<<<<<<<<<<<
*
* def __cmp__(self, Rule other):
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -29794,12 +31538,12 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_
PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->e));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self->e));
__pyx_t_1 = 0;
- __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_3;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":168
+ /* "cdec/sa/rule.pxi":187
* self.scores = scores
*
* def __hash__(self): # <<<<<<<<<<<<<<
@@ -29819,7 +31563,7 @@ static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":171
+/* "cdec/sa/rule.pxi":190
* return hash((self.lhs, self.f, self.e))
*
* def __cmp__(self, Rule other): # <<<<<<<<<<<<<<
@@ -29837,7 +31581,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObje
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_2sa_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_4cdec_2sa_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_other));
/* function exit code */
@@ -29863,16 +31607,16 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(struct __pyx_obj_4cdec_2sa_3_s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cmp__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":172
+ /* "cdec/sa/rule.pxi":191
*
* def __cmp__(self, Rule other):
* return cmp((self.lhs, self.f, self.e, self.word_alignments), # <<<<<<<<<<<<<<
* (other.lhs, other.f, other.e, self.word_alignments))
*
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -29887,16 +31631,16 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_GIVEREF(__pyx_v_self->word_alignments);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":173
+ /* "cdec/sa/rule.pxi":192
* def __cmp__(self, Rule other):
* return cmp((self.lhs, self.f, self.e, self.word_alignments),
* (other.lhs, other.f, other.e, self.word_alignments)) # <<<<<<<<<<<<<<
*
* def fmerge(self, Phrase f):
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_other->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_other->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -29911,14 +31655,14 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_GIVEREF(__pyx_v_self->word_alignments);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":172
+ /* "cdec/sa/rule.pxi":191
*
* def __cmp__(self, Rule other):
* return cmp((self.lhs, self.f, self.e, self.word_alignments), # <<<<<<<<<<<<<<
* (other.lhs, other.f, other.e, self.word_alignments))
*
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
@@ -29926,15 +31670,15 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(struct __pyx_obj_4cdec_2sa_3_s
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":171
+ /* "cdec/sa/rule.pxi":190
* return hash((self.lhs, self.f, self.e))
*
* def __cmp__(self, Rule other): # <<<<<<<<<<<<<<
@@ -29955,7 +31699,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_4Rule_4__cmp__(struct __pyx_obj_4cdec_2sa_3_s
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":175
+/* "cdec/sa/rule.pxi":194
* (other.lhs, other.f, other.e, self.word_alignments))
*
* def fmerge(self, Phrase f): # <<<<<<<<<<<<<<
@@ -29972,7 +31716,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, P
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fmerge (wrapper)", 0);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_4cdec_2sa_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_6fmerge(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_f));
/* function exit code */
@@ -29994,19 +31738,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_6fmerge(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fmerge", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":176
+ /* "cdec/sa/rule.pxi":195
*
* def fmerge(self, Phrase f):
* if self.f == f: # <<<<<<<<<<<<<<
* self.f = f
*
*/
- __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->f), ((PyObject *)__pyx_v_f), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 176; __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[7]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->f), ((PyObject *)__pyx_v_f), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 195; __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[7]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":177
+ /* "cdec/sa/rule.pxi":196
* def fmerge(self, Phrase f):
* if self.f == f:
* self.f = f # <<<<<<<<<<<<<<
@@ -30022,7 +31766,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_6fmerge(struct __pyx_obj_4cdec_2s
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":175
+ /* "cdec/sa/rule.pxi":194
* (other.lhs, other.f, other.e, self.word_alignments))
*
* def fmerge(self, Phrase f): # <<<<<<<<<<<<<<
@@ -30043,7 +31787,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_6fmerge(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":179
+/* "cdec/sa/rule.pxi":198
* self.f = f
*
* def arity(self): # <<<<<<<<<<<<<<
@@ -30069,12 +31813,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("arity", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":180
+ /* "cdec/sa/rule.pxi":199
*
* def arity(self):
* return self.f.arity() # <<<<<<<<<<<<<<
@@ -30082,16 +31827,31 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa
* def __str__(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->f), __pyx_n_s_arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->f), __pyx_n_s_arity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":179
+ /* "cdec/sa/rule.pxi":198
* self.f = f
*
* def arity(self): # <<<<<<<<<<<<<<
@@ -30103,6 +31863,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec.sa._sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -30111,7 +31872,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182
+/* "cdec/sa/rule.pxi":201
* return self.f.arity()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -30131,9 +31892,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self)
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186
+/* "cdec/sa/rule.pxi":205
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)]
* if self.word_alignments is not None:
* fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<<
@@ -30142,50 +31903,48 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator14, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_str___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.Rule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
- Py_ssize_t __pyx_t_3;
- PyObject *(*__pyx_t_4)(PyObject *);
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *(*__pyx_t_5)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -30199,75 +31958,92 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_alignments); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
- __pyx_t_4 = NULL;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ } else {
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
- if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_4(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_1 = __pyx_t_5(__pyx_t_2);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d_d_2, __pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- __Pyx_XGIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
- __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_d_d_2, __pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L6_resume_from_yield:;
- __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
- __Pyx_XGOTREF(__pyx_t_1);
- __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
- __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_XGOTREF(__pyx_t_2);
+ __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* function exit code */
PyErr_SetNone(PyExc_StopIteration);
@@ -30275,6 +32051,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -30284,7 +32061,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182
+/* "cdec/sa/rule.pxi":201
* return self.f.arity()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -30293,7 +32070,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_7__str___2generator13(__pyx_Gener
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *__pyx_cur_scope;
PyObject *__pyx_v_fields = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -30309,7 +32086,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17___str__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -30319,40 +32096,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":184
+ /* "cdec/sa/rule.pxi":203
* def __str__(self):
* cdef unsigned i
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] # <<<<<<<<<<<<<<
* if self.word_alignments is not None:
* fields.append(' '.join('%d-%d' % a for a in self.alignments()))
*/
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_cur_scope->__pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_cur_scope->__pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->f));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->f));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->f));
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->e));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->e));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->e));
- __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->scores));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_self->scores));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->scores));
- __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -30369,7 +32146,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
__pyx_v_fields = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":185
+ /* "cdec/sa/rule.pxi":204
* cdef unsigned i
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)]
* if self.word_alignments is not None: # <<<<<<<<<<<<<<
@@ -30380,25 +32157,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
__pyx_t_7 = (__pyx_t_6 != 0);
if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186
+ /* "cdec/sa/rule.pxi":205
* fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)]
* if self.word_alignments is not None:
* fields.append(' '.join('%d-%d' % a for a in self.alignments())) # <<<<<<<<<<<<<<
* return ' ||| '.join(fields)
*
*/
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__46, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__46, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_fields, __pyx_t_5); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_fields, __pyx_t_5); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":187
+ /* "cdec/sa/rule.pxi":206
* if self.word_alignments is not None:
* fields.append(' '.join('%d-%d' % a for a in self.alignments()))
* return ' ||| '.join(fields) # <<<<<<<<<<<<<<
@@ -30406,13 +32183,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
* def alignments(self):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__10, __pyx_v_fields); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__10, __pyx_v_fields); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182
+ /* "cdec/sa/rule.pxi":201
* return self.f.arity()
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -30436,9 +32213,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189
+/* "cdec/sa/rule.pxi":208
* return ' ||| '.join(fields)
*
* def alignments(self): # <<<<<<<<<<<<<<
@@ -30460,14 +32237,14 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_se
}
static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("alignments", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -30477,28 +32254,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(struct __pyx_obj_4cd
__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_2sa_3_sa_4Rule_14generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_4Rule_14generator4, (PyObject *) __pyx_cur_scope, __pyx_n_s_alignments, __pyx_n_s_Rule_alignments); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.Rule.alignments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -30519,44 +32293,46 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObjec
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":190
+ /* "cdec/sa/rule.pxi":209
*
* def alignments(self):
* for point in self.word_alignments: # <<<<<<<<<<<<<<
* yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE
*/
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_self->word_alignments)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_v_self->word_alignments; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_self->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_self->word_alignments); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -30567,22 +32343,22 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObjec
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":191
+ /* "cdec/sa/rule.pxi":210
* def alignments(self):
* for point in self.word_alignments:
* yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE # <<<<<<<<<<<<<<
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_cur_scope->__pyx_v_point, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_cur_scope->__pyx_v_point, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyNumber_Remainder(__pyx_cur_scope->__pyx_v_point, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Remainder(__pyx_cur_scope->__pyx_v_point, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
@@ -30607,11 +32383,18 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObjec
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/rule.pxi":209
+ *
+ * def alignments(self):
+ * for point in self.word_alignments: # <<<<<<<<<<<<<<
+ * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189
+ /* "cdec/sa/rule.pxi":208
* return ' ||| '.join(fields)
*
* def alignments(self): # <<<<<<<<<<<<<<
@@ -30636,7 +32419,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObjec
return NULL;
}
-/* "cdec/sa/_sa.pxd":37
+/* "cdec/sa/_sa.pxd":39
* cdef class Rule:
* cdef int lhs
* cdef readonly Phrase f, e # <<<<<<<<<<<<<<
@@ -30702,7 +32485,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":21
+/* "cdec/sa/precomputation.pxi":21
* int arr_len
*
* cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<<
@@ -30716,7 +32499,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("new_trie_node", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":23
+ /* "cdec/sa/precomputation.pxi":23
* cdef _Trie_Node* new_trie_node():
* cdef _Trie_Node* node
* node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) # <<<<<<<<<<<<<<
@@ -30725,7 +32508,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_node = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":24
+ /* "cdec/sa/precomputation.pxi":24
* cdef _Trie_Node* node
* node = <_Trie_Node*> malloc(sizeof(_Trie_Node))
* node.root = NULL # <<<<<<<<<<<<<<
@@ -30734,7 +32517,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_node->root = NULL;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":25
+ /* "cdec/sa/precomputation.pxi":25
* node = <_Trie_Node*> malloc(sizeof(_Trie_Node))
* node.root = NULL
* node.arr_len = 0 # <<<<<<<<<<<<<<
@@ -30743,7 +32526,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_node->arr_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":26
+ /* "cdec/sa/precomputation.pxi":26
* node.root = NULL
* node.arr_len = 0
* node.arr = <int*> malloc(sizeof(0*sizeof(int))) # <<<<<<<<<<<<<<
@@ -30752,7 +32535,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_node->arr = ((int *)malloc((sizeof((0 * (sizeof(int)))))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":27
+ /* "cdec/sa/precomputation.pxi":27
* node.arr_len = 0
* node.arr = <int*> malloc(sizeof(0*sizeof(int)))
* return node # <<<<<<<<<<<<<<
@@ -30762,7 +32545,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
__pyx_r = __pyx_v_node;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":21
+ /* "cdec/sa/precomputation.pxi":21
* int arr_len
*
* cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<<
@@ -30776,7 +32559,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":29
+/* "cdec/sa/precomputation.pxi":29
* return node
*
* cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<<
@@ -30790,7 +32573,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("new_trie_edge", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":31
+ /* "cdec/sa/precomputation.pxi":31
* cdef _Trie_Edge* new_trie_edge(int val):
* cdef _Trie_Edge* edge
* edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) # <<<<<<<<<<<<<<
@@ -30799,7 +32582,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_edge = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":32
+ /* "cdec/sa/precomputation.pxi":32
* cdef _Trie_Edge* edge
* edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge))
* edge.node = new_trie_node() # <<<<<<<<<<<<<<
@@ -30808,7 +32591,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_edge->node = __pyx_f_4cdec_2sa_3_sa_new_trie_node();
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":33
+ /* "cdec/sa/precomputation.pxi":33
* edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge))
* edge.node = new_trie_node()
* edge.bigger = NULL # <<<<<<<<<<<<<<
@@ -30817,7 +32600,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_edge->bigger = NULL;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":34
+ /* "cdec/sa/precomputation.pxi":34
* edge.node = new_trie_node()
* edge.bigger = NULL
* edge.smaller = NULL # <<<<<<<<<<<<<<
@@ -30826,7 +32609,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_edge->smaller = NULL;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":35
+ /* "cdec/sa/precomputation.pxi":35
* edge.bigger = NULL
* edge.smaller = NULL
* edge.val = val # <<<<<<<<<<<<<<
@@ -30835,7 +32618,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
*/
__pyx_v_edge->val = __pyx_v_val;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":36
+ /* "cdec/sa/precomputation.pxi":36
* edge.smaller = NULL
* edge.val = val
* return edge # <<<<<<<<<<<<<<
@@ -30845,7 +32628,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
__pyx_r = __pyx_v_edge;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":29
+ /* "cdec/sa/precomputation.pxi":29
* return node
*
* cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<<
@@ -30859,7 +32642,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":38
+/* "cdec/sa/precomputation.pxi":38
* return edge
*
* cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<<
@@ -30877,7 +32660,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("free_trie_node", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":39
+ /* "cdec/sa/precomputation.pxi":39
*
* cdef free_trie_node(_Trie_Node* node):
* if node != NULL: # <<<<<<<<<<<<<<
@@ -30887,7 +32670,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_node != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":40
+ /* "cdec/sa/precomputation.pxi":40
* cdef free_trie_node(_Trie_Node* node):
* if node != NULL:
* free_trie_edge(node.root) # <<<<<<<<<<<<<<
@@ -30898,7 +32681,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":41
+ /* "cdec/sa/precomputation.pxi":41
* if node != NULL:
* free_trie_edge(node.root)
* free(node.arr) # <<<<<<<<<<<<<<
@@ -30910,7 +32693,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":38
+ /* "cdec/sa/precomputation.pxi":38
* return edge
*
* cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<<
@@ -30931,7 +32714,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":43
+/* "cdec/sa/precomputation.pxi":43
* free(node.arr)
*
* cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<<
@@ -30949,7 +32732,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("free_trie_edge", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":44
+ /* "cdec/sa/precomputation.pxi":44
*
* cdef free_trie_edge(_Trie_Edge* edge):
* if edge != NULL: # <<<<<<<<<<<<<<
@@ -30959,7 +32742,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
__pyx_t_1 = ((__pyx_v_edge != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":45
+ /* "cdec/sa/precomputation.pxi":45
* cdef free_trie_edge(_Trie_Edge* edge):
* if edge != NULL:
* free_trie_node(edge.node) # <<<<<<<<<<<<<<
@@ -30970,7 +32753,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":46
+ /* "cdec/sa/precomputation.pxi":46
* if edge != NULL:
* free_trie_node(edge.node)
* free_trie_edge(edge.bigger) # <<<<<<<<<<<<<<
@@ -30981,7 +32764,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":47
+ /* "cdec/sa/precomputation.pxi":47
* free_trie_node(edge.node)
* free_trie_edge(edge.bigger)
* free_trie_edge(edge.smaller) # <<<<<<<<<<<<<<
@@ -30995,7 +32778,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":43
+ /* "cdec/sa/precomputation.pxi":43
* free(node.arr)
*
* cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<<
@@ -31016,7 +32799,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":49
+/* "cdec/sa/precomputation.pxi":49
* free_trie_edge(edge.smaller)
*
* cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31031,10 +32814,9 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
__Pyx_RefNannySetupContext("trie_find", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":51
+ /* "cdec/sa/precomputation.pxi":51
* cdef _Trie_Node* trie_find(_Trie_Node* node, int val):
* cdef _Trie_Edge* cur
* cur = node.root # <<<<<<<<<<<<<<
@@ -31044,7 +32826,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
__pyx_t_1 = __pyx_v_node->root;
__pyx_v_cur = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":52
+ /* "cdec/sa/precomputation.pxi":52
* cdef _Trie_Edge* cur
* cur = node.root
* while cur != NULL and cur.val != val: # <<<<<<<<<<<<<<
@@ -31052,26 +32834,30 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
* cur = cur.bigger
*/
while (1) {
- __pyx_t_2 = ((__pyx_v_cur != NULL) != 0);
- if (__pyx_t_2) {
- __pyx_t_3 = ((__pyx_v_cur->val != __pyx_v_val) != 0);
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_3 = ((__pyx_v_cur != NULL) != 0);
+ if (__pyx_t_3) {
+ goto __pyx_L6_next_and;
} else {
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L5_bool_binop_done;
}
- if (!__pyx_t_4) break;
+ __pyx_L6_next_and:;
+ __pyx_t_3 = ((__pyx_v_cur->val != __pyx_v_val) != 0);
+ __pyx_t_2 = __pyx_t_3;
+ __pyx_L5_bool_binop_done:;
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":53
+ /* "cdec/sa/precomputation.pxi":53
* cur = node.root
* while cur != NULL and cur.val != val:
* if val > cur.val: # <<<<<<<<<<<<<<
* cur = cur.bigger
* elif val < cur.val:
*/
- __pyx_t_4 = ((__pyx_v_val > __pyx_v_cur->val) != 0);
- if (__pyx_t_4) {
+ __pyx_t_2 = ((__pyx_v_val > __pyx_v_cur->val) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":54
+ /* "cdec/sa/precomputation.pxi":54
* while cur != NULL and cur.val != val:
* if val > cur.val:
* cur = cur.bigger # <<<<<<<<<<<<<<
@@ -31080,20 +32866,20 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
*/
__pyx_t_1 = __pyx_v_cur->bigger;
__pyx_v_cur = __pyx_t_1;
- goto __pyx_L5;
+ goto __pyx_L7;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":55
+ /* "cdec/sa/precomputation.pxi":55
* if val > cur.val:
* cur = cur.bigger
* elif val < cur.val: # <<<<<<<<<<<<<<
* cur = cur.smaller
* if cur == NULL:
*/
- __pyx_t_4 = ((__pyx_v_val < __pyx_v_cur->val) != 0);
- if (__pyx_t_4) {
+ __pyx_t_2 = ((__pyx_v_val < __pyx_v_cur->val) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":56
+ /* "cdec/sa/precomputation.pxi":56
* cur = cur.bigger
* elif val < cur.val:
* cur = cur.smaller # <<<<<<<<<<<<<<
@@ -31102,22 +32888,22 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
*/
__pyx_t_1 = __pyx_v_cur->smaller;
__pyx_v_cur = __pyx_t_1;
- goto __pyx_L5;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":57
+ /* "cdec/sa/precomputation.pxi":57
* elif val < cur.val:
* cur = cur.smaller
* if cur == NULL: # <<<<<<<<<<<<<<
* return NULL
* else:
*/
- __pyx_t_4 = ((__pyx_v_cur == NULL) != 0);
- if (__pyx_t_4) {
+ __pyx_t_2 = ((__pyx_v_cur == NULL) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":58
+ /* "cdec/sa/precomputation.pxi":58
* cur = cur.smaller
* if cur == NULL:
* return NULL # <<<<<<<<<<<<<<
@@ -31129,7 +32915,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":60
+ /* "cdec/sa/precomputation.pxi":60
* return NULL
* else:
* return cur.node # <<<<<<<<<<<<<<
@@ -31140,7 +32926,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":49
+ /* "cdec/sa/precomputation.pxi":49
* free_trie_edge(edge.smaller)
*
* cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31154,7 +32940,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_fin
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":62
+/* "cdec/sa/precomputation.pxi":62
* return cur.node
*
* cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31168,7 +32954,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("trie_node_data_append", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":64
+ /* "cdec/sa/precomputation.pxi":64
* cdef trie_node_data_append(_Trie_Node* node, int val):
* cdef int new_len
* new_len = node.arr_len + 1 # <<<<<<<<<<<<<<
@@ -31177,7 +32963,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
*/
__pyx_v_new_len = (__pyx_v_node->arr_len + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":65
+ /* "cdec/sa/precomputation.pxi":65
* cdef int new_len
* new_len = node.arr_len + 1
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -31186,7 +32972,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
*/
__pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":66
+ /* "cdec/sa/precomputation.pxi":66
* new_len = node.arr_len + 1
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int))
* node.arr[node.arr_len] = val # <<<<<<<<<<<<<<
@@ -31195,7 +32981,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
*/
(__pyx_v_node->arr[__pyx_v_node->arr_len]) = __pyx_v_val;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":67
+ /* "cdec/sa/precomputation.pxi":67
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int))
* node.arr[node.arr_len] = val
* node.arr_len = new_len # <<<<<<<<<<<<<<
@@ -31204,7 +32990,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
*/
__pyx_v_node->arr_len = __pyx_v_new_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":62
+ /* "cdec/sa/precomputation.pxi":62
* return cur.node
*
* cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31219,7 +33005,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":69
+/* "cdec/sa/precomputation.pxi":69
* node.arr_len = new_len
*
* cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<<
@@ -31233,7 +33019,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("trie_node_data_extend", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":71
+ /* "cdec/sa/precomputation.pxi":71
* cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals):
* cdef int new_len
* new_len = node.arr_len + num_vals # <<<<<<<<<<<<<<
@@ -31242,7 +33028,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
*/
__pyx_v_new_len = (__pyx_v_node->arr_len + __pyx_v_num_vals);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":72
+ /* "cdec/sa/precomputation.pxi":72
* cdef int new_len
* new_len = node.arr_len + num_vals
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -31251,7 +33037,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
*/
__pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":73
+ /* "cdec/sa/precomputation.pxi":73
* new_len = node.arr_len + num_vals
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int))
* memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) # <<<<<<<<<<<<<<
@@ -31260,7 +33046,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
*/
memcpy((__pyx_v_node->arr + __pyx_v_node->arr_len), __pyx_v_vals, (__pyx_v_num_vals * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":74
+ /* "cdec/sa/precomputation.pxi":74
* node.arr = <int*> realloc(node.arr, new_len*sizeof(int))
* memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int))
* node.arr_len = new_len # <<<<<<<<<<<<<<
@@ -31269,7 +33055,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
*/
__pyx_v_node->arr_len = __pyx_v_new_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":69
+ /* "cdec/sa/precomputation.pxi":69
* node.arr_len = new_len
*
* cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<<
@@ -31284,7 +33070,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":77
+/* "cdec/sa/precomputation.pxi":77
*
*
* cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31298,10 +33084,9 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("trie_insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":79
+ /* "cdec/sa/precomputation.pxi":79
* cdef _Trie_Node* trie_insert(_Trie_Node* node, int val):
* cdef _Trie_Edge** cur
* cur = &node.root # <<<<<<<<<<<<<<
@@ -31310,7 +33095,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
*/
__pyx_v_cur = (&__pyx_v_node->root);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":80
+ /* "cdec/sa/precomputation.pxi":80
* cdef _Trie_Edge** cur
* cur = &node.root
* while cur[0] != NULL and cur[0].val != val: # <<<<<<<<<<<<<<
@@ -31318,26 +33103,30 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
* cur = &cur[0].bigger
*/
while (1) {
- __pyx_t_1 = (((__pyx_v_cur[0]) != NULL) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = (((__pyx_v_cur[0])->val != __pyx_v_val) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = (((__pyx_v_cur[0]) != NULL) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L6_next_and;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (!__pyx_t_3) break;
+ __pyx_L6_next_and:;
+ __pyx_t_2 = (((__pyx_v_cur[0])->val != __pyx_v_val) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":81
+ /* "cdec/sa/precomputation.pxi":81
* cur = &node.root
* while cur[0] != NULL and cur[0].val != val:
* if val > cur[0].val: # <<<<<<<<<<<<<<
* cur = &cur[0].bigger
* elif val < cur[0].val:
*/
- __pyx_t_3 = ((__pyx_v_val > (__pyx_v_cur[0])->val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_val > (__pyx_v_cur[0])->val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":82
+ /* "cdec/sa/precomputation.pxi":82
* while cur[0] != NULL and cur[0].val != val:
* if val > cur[0].val:
* cur = &cur[0].bigger # <<<<<<<<<<<<<<
@@ -31345,20 +33134,20 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
* cur = &cur[0].smaller
*/
__pyx_v_cur = (&(__pyx_v_cur[0])->bigger);
- goto __pyx_L5;
+ goto __pyx_L7;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":83
+ /* "cdec/sa/precomputation.pxi":83
* if val > cur[0].val:
* cur = &cur[0].bigger
* elif val < cur[0].val: # <<<<<<<<<<<<<<
* cur = &cur[0].smaller
* if cur[0] == NULL:
*/
- __pyx_t_3 = ((__pyx_v_val < (__pyx_v_cur[0])->val) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_val < (__pyx_v_cur[0])->val) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":84
+ /* "cdec/sa/precomputation.pxi":84
* cur = &cur[0].bigger
* elif val < cur[0].val:
* cur = &cur[0].smaller # <<<<<<<<<<<<<<
@@ -31366,22 +33155,22 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
* cur[0] = new_trie_edge(val)
*/
__pyx_v_cur = (&(__pyx_v_cur[0])->smaller);
- goto __pyx_L5;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":85
+ /* "cdec/sa/precomputation.pxi":85
* elif val < cur[0].val:
* cur = &cur[0].smaller
* if cur[0] == NULL: # <<<<<<<<<<<<<<
* cur[0] = new_trie_edge(val)
* return cur[0].node
*/
- __pyx_t_3 = (((__pyx_v_cur[0]) == NULL) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_cur[0]) == NULL) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":86
+ /* "cdec/sa/precomputation.pxi":86
* cur = &cur[0].smaller
* if cur[0] == NULL:
* cur[0] = new_trie_edge(val) # <<<<<<<<<<<<<<
@@ -31389,11 +33178,11 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
*
*/
(__pyx_v_cur[0]) = __pyx_f_4cdec_2sa_3_sa_new_trie_edge(__pyx_v_val);
- goto __pyx_L6;
+ goto __pyx_L8;
}
- __pyx_L6:;
+ __pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":87
+ /* "cdec/sa/precomputation.pxi":87
* if cur[0] == NULL:
* cur[0] = new_trie_edge(val)
* return cur[0].node # <<<<<<<<<<<<<<
@@ -31403,7 +33192,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
__pyx_r = (__pyx_v_cur[0])->node;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":77
+ /* "cdec/sa/precomputation.pxi":77
*
*
* cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<<
@@ -31417,7 +33206,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_ins
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":89
+/* "cdec/sa/precomputation.pxi":89
* return cur[0].node
*
* cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<<
@@ -31438,22 +33227,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("trie_node_to_map", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":92
+ /* "cdec/sa/precomputation.pxi":92
* cdef IntList arr
*
* if include_zeros or node.arr_len > 0: # <<<<<<<<<<<<<<
* arr = IntList()
* free(arr.arr)
*/
- if (!(__pyx_v_include_zeros != 0)) {
- __pyx_t_1 = (__pyx_v_node->arr_len > 0);
- __pyx_t_2 = __pyx_t_1;
+ __pyx_t_2 = (__pyx_v_include_zeros != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_2 = (__pyx_v_include_zeros != 0);
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_2) {
+ __pyx_L5_next_or:;
+ __pyx_t_2 = ((__pyx_v_node->arr_len > 0) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":93
+ /* "cdec/sa/precomputation.pxi":93
*
* if include_zeros or node.arr_len > 0:
* arr = IntList() # <<<<<<<<<<<<<<
@@ -31465,7 +33259,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
__pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":94
+ /* "cdec/sa/precomputation.pxi":94
* if include_zeros or node.arr_len > 0:
* arr = IntList()
* free(arr.arr) # <<<<<<<<<<<<<<
@@ -31474,7 +33268,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
*/
free(__pyx_v_arr->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":95
+ /* "cdec/sa/precomputation.pxi":95
* arr = IntList()
* free(arr.arr)
* arr.arr = <int*> malloc(node.arr_len * sizeof(int)) # <<<<<<<<<<<<<<
@@ -31483,7 +33277,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
*/
__pyx_v_arr->arr = ((int *)malloc((__pyx_v_node->arr_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":96
+ /* "cdec/sa/precomputation.pxi":96
* free(arr.arr)
* arr.arr = <int*> malloc(node.arr_len * sizeof(int))
* memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) # <<<<<<<<<<<<<<
@@ -31492,7 +33286,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
*/
memcpy(__pyx_v_arr->arr, __pyx_v_node->arr, (__pyx_v_node->arr_len * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":97
+ /* "cdec/sa/precomputation.pxi":97
* arr.arr = <int*> malloc(node.arr_len * sizeof(int))
* memcpy(arr.arr, node.arr, node.arr_len * sizeof(int))
* arr.len = node.arr_len # <<<<<<<<<<<<<<
@@ -31502,7 +33296,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
__pyx_t_4 = __pyx_v_node->arr_len;
__pyx_v_arr->len = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":98
+ /* "cdec/sa/precomputation.pxi":98
* memcpy(arr.arr, node.arr, node.arr_len * sizeof(int))
* arr.len = node.arr_len
* arr.size = node.arr_len # <<<<<<<<<<<<<<
@@ -31512,7 +33306,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
__pyx_t_4 = __pyx_v_node->arr_len;
__pyx_v_arr->size = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":99
+ /* "cdec/sa/precomputation.pxi":99
* arr.len = node.arr_len
* arr.size = node.arr_len
* result[prefix] = arr # <<<<<<<<<<<<<<
@@ -31524,7 +33318,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":100
+ /* "cdec/sa/precomputation.pxi":100
* arr.size = node.arr_len
* result[prefix] = arr
* trie_edge_to_map(node.root, result, prefix, include_zeros) # <<<<<<<<<<<<<<
@@ -31535,7 +33329,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":89
+ /* "cdec/sa/precomputation.pxi":89
* return cur[0].node
*
* cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<<
@@ -31557,7 +33351,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":102
+/* "cdec/sa/precomputation.pxi":102
* trie_edge_to_map(node.root, result, prefix, include_zeros)
*
* cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): # <<<<<<<<<<<<<<
@@ -31577,7 +33371,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
__Pyx_RefNannySetupContext("trie_edge_to_map", 0);
__Pyx_INCREF(__pyx_v_prefix);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":103
+ /* "cdec/sa/precomputation.pxi":103
*
* cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros):
* if edge != NULL: # <<<<<<<<<<<<<<
@@ -31587,7 +33381,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
__pyx_t_1 = ((__pyx_v_edge != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":104
+ /* "cdec/sa/precomputation.pxi":104
* cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros):
* if edge != NULL:
* trie_edge_to_map(edge.smaller, result, prefix, include_zeros) # <<<<<<<<<<<<<<
@@ -31598,7 +33392,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":105
+ /* "cdec/sa/precomputation.pxi":105
* if edge != NULL:
* trie_edge_to_map(edge.smaller, result, prefix, include_zeros)
* trie_edge_to_map(edge.bigger, result, prefix, include_zeros) # <<<<<<<<<<<<<<
@@ -31609,7 +33403,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":106
+ /* "cdec/sa/precomputation.pxi":106
* trie_edge_to_map(edge.smaller, result, prefix, include_zeros)
* trie_edge_to_map(edge.bigger, result, prefix, include_zeros)
* prefix = prefix + (edge.val,) # <<<<<<<<<<<<<<
@@ -31629,7 +33423,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
__Pyx_DECREF_SET(__pyx_v_prefix, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":107
+ /* "cdec/sa/precomputation.pxi":107
* trie_edge_to_map(edge.bigger, result, prefix, include_zeros)
* prefix = prefix + (edge.val,)
* trie_node_to_map(edge.node, result, prefix, include_zeros) # <<<<<<<<<<<<<<
@@ -31643,7 +33437,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":102
+ /* "cdec/sa/precomputation.pxi":102
* trie_edge_to_map(node.root, result, prefix, include_zeros)
*
* cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): # <<<<<<<<<<<<<<
@@ -31666,7 +33460,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":114
+/* "cdec/sa/precomputation.pxi":114
* cdef int V
*
* def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<<
@@ -31731,7 +33525,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":115
+ /* "cdec/sa/precomputation.pxi":115
*
* def __cinit__(self, int alphabet_size):
* self.V = alphabet_size # <<<<<<<<<<<<<<
@@ -31740,7 +33534,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->V = __pyx_v_alphabet_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":116
+ /* "cdec/sa/precomputation.pxi":116
* def __cinit__(self, int alphabet_size):
* self.V = alphabet_size
* self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) # <<<<<<<<<<<<<<
@@ -31749,7 +33543,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->root = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Node **)malloc((__pyx_v_self->V * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":117
+ /* "cdec/sa/precomputation.pxi":117
* self.V = alphabet_size
* self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*))
* memset(self.root, 0, self.V * sizeof(_Trie_Node*)) # <<<<<<<<<<<<<<
@@ -31758,7 +33552,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa
*/
memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":114
+ /* "cdec/sa/precomputation.pxi":114
* cdef int V
*
* def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<<
@@ -31772,7 +33566,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":120
+/* "cdec/sa/precomputation.pxi":120
*
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -31802,7 +33596,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__dealloc__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":122
+ /* "cdec/sa/precomputation.pxi":122
* def __dealloc__(self):
* cdef int i
* for i from 0 <= i < self.V: # <<<<<<<<<<<<<<
@@ -31812,7 +33606,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
__pyx_t_1 = __pyx_v_self->V;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":123
+ /* "cdec/sa/precomputation.pxi":123
* cdef int i
* for i from 0 <= i < self.V:
* if self.root[i] != NULL: # <<<<<<<<<<<<<<
@@ -31822,7 +33616,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
__pyx_t_2 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":124
+ /* "cdec/sa/precomputation.pxi":124
* for i from 0 <= i < self.V:
* if self.root[i] != NULL:
* free_trie_node(self.root[i]) # <<<<<<<<<<<<<<
@@ -31837,7 +33631,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
__pyx_L5:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":125
+ /* "cdec/sa/precomputation.pxi":125
* if self.root[i] != NULL:
* free_trie_node(self.root[i])
* free(self.root) # <<<<<<<<<<<<<<
@@ -31846,7 +33640,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
*/
free(__pyx_v_self->root);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":120
+ /* "cdec/sa/precomputation.pxi":120
*
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -31863,7 +33657,7 @@ static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":128
+/* "cdec/sa/precomputation.pxi":128
*
*
* def insert(self, pattern): # <<<<<<<<<<<<<<
@@ -31899,7 +33693,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":131
+ /* "cdec/sa/precomputation.pxi":131
* cdef int* p
* cdef int i, l
* l = len(pattern) # <<<<<<<<<<<<<<
@@ -31909,7 +33703,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
__pyx_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_l = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":132
+ /* "cdec/sa/precomputation.pxi":132
* cdef int i, l
* l = len(pattern)
* p = <int*> malloc(l*sizeof(int)) # <<<<<<<<<<<<<<
@@ -31918,7 +33712,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
*/
__pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":133
+ /* "cdec/sa/precomputation.pxi":133
* l = len(pattern)
* p = <int*> malloc(l*sizeof(int))
* for i from 0 <= i < l: # <<<<<<<<<<<<<<
@@ -31928,7 +33722,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
__pyx_t_2 = __pyx_v_l;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":134
+ /* "cdec/sa/precomputation.pxi":134
* p = <int*> malloc(l*sizeof(int))
* for i from 0 <= i < l:
* p[i] = pattern[i] # <<<<<<<<<<<<<<
@@ -31942,7 +33736,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
(__pyx_v_p[__pyx_v_i]) = __pyx_t_4;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":135
+ /* "cdec/sa/precomputation.pxi":135
* for i from 0 <= i < l:
* p[i] = pattern[i]
* self._insert(p,l) # <<<<<<<<<<<<<<
@@ -31951,7 +33745,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":136
+ /* "cdec/sa/precomputation.pxi":136
* p[i] = pattern[i]
* self._insert(p,l)
* free(p) # <<<<<<<<<<<<<<
@@ -31960,7 +33754,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
*/
free(__pyx_v_p);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":128
+ /* "cdec/sa/precomputation.pxi":128
*
*
* def insert(self, pattern): # <<<<<<<<<<<<<<
@@ -31981,7 +33775,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":139
+/* "cdec/sa/precomputation.pxi":139
*
*
* cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<<
@@ -31998,7 +33792,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
int __pyx_t_2;
__Pyx_RefNannySetupContext("_insert", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":142
+ /* "cdec/sa/precomputation.pxi":142
* cdef int i
* cdef _Trie_Node* node
* if self.root[pattern[0]] == NULL: # <<<<<<<<<<<<<<
@@ -32008,7 +33802,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_t_1 = (((__pyx_v_self->root[(__pyx_v_pattern[0])]) == NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":143
+ /* "cdec/sa/precomputation.pxi":143
* cdef _Trie_Node* node
* if self.root[pattern[0]] == NULL:
* self.root[pattern[0]] = new_trie_node() # <<<<<<<<<<<<<<
@@ -32020,7 +33814,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":144
+ /* "cdec/sa/precomputation.pxi":144
* if self.root[pattern[0]] == NULL:
* self.root[pattern[0]] = new_trie_node()
* node = self.root[pattern[0]] # <<<<<<<<<<<<<<
@@ -32029,7 +33823,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
*/
__pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":145
+ /* "cdec/sa/precomputation.pxi":145
* self.root[pattern[0]] = new_trie_node()
* node = self.root[pattern[0]]
* for i from 1 <= i < pattern_len: # <<<<<<<<<<<<<<
@@ -32039,7 +33833,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_t_2 = __pyx_v_pattern_len;
for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":146
+ /* "cdec/sa/precomputation.pxi":146
* node = self.root[pattern[0]]
* for i from 1 <= i < pattern_len:
* node = trie_insert(node, pattern[i]) # <<<<<<<<<<<<<<
@@ -32049,7 +33843,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i]));
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":147
+ /* "cdec/sa/precomputation.pxi":147
* for i from 1 <= i < pattern_len:
* node = trie_insert(node, pattern[i])
* return node # <<<<<<<<<<<<<<
@@ -32059,7 +33853,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_r = __pyx_v_node;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":139
+ /* "cdec/sa/precomputation.pxi":139
*
*
* cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<<
@@ -32073,7 +33867,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":149
+/* "cdec/sa/precomputation.pxi":149
* return node
*
* def contains(self, pattern): # <<<<<<<<<<<<<<
@@ -32111,7 +33905,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("contains", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":153
+ /* "cdec/sa/precomputation.pxi":153
* cdef int i, l
* cdef _Trie_Node* node
* l = len(pattern) # <<<<<<<<<<<<<<
@@ -32121,7 +33915,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
__pyx_t_1 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_l = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":154
+ /* "cdec/sa/precomputation.pxi":154
* cdef _Trie_Node* node
* l = len(pattern)
* p = <int*> malloc(l*sizeof(int)) # <<<<<<<<<<<<<<
@@ -32130,7 +33924,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
*/
__pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":155
+ /* "cdec/sa/precomputation.pxi":155
* l = len(pattern)
* p = <int*> malloc(l*sizeof(int))
* for i from 0 <= i < l: # <<<<<<<<<<<<<<
@@ -32140,7 +33934,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
__pyx_t_2 = __pyx_v_l;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":156
+ /* "cdec/sa/precomputation.pxi":156
* p = <int*> malloc(l*sizeof(int))
* for i from 0 <= i < l:
* p[i] = pattern[i] # <<<<<<<<<<<<<<
@@ -32154,7 +33948,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
(__pyx_v_p[__pyx_v_i]) = __pyx_t_4;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":157
+ /* "cdec/sa/precomputation.pxi":157
* for i from 0 <= i < l:
* p[i] = pattern[i]
* node = self._contains(p,l) # <<<<<<<<<<<<<<
@@ -32163,7 +33957,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
*/
__pyx_v_node = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_contains(__pyx_v_self, __pyx_v_p, __pyx_v_l);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":158
+ /* "cdec/sa/precomputation.pxi":158
* p[i] = pattern[i]
* node = self._contains(p,l)
* free(p) # <<<<<<<<<<<<<<
@@ -32172,7 +33966,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
*/
free(__pyx_v_p);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":159
+ /* "cdec/sa/precomputation.pxi":159
* node = self._contains(p,l)
* free(p)
* if node == NULL: # <<<<<<<<<<<<<<
@@ -32182,7 +33976,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
__pyx_t_5 = ((__pyx_v_node == NULL) != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":160
+ /* "cdec/sa/precomputation.pxi":160
* free(p)
* if node == NULL:
* return False # <<<<<<<<<<<<<<
@@ -32196,7 +33990,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":162
+ /* "cdec/sa/precomputation.pxi":162
* return False
* else:
* return True # <<<<<<<<<<<<<<
@@ -32209,7 +34003,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":149
+ /* "cdec/sa/precomputation.pxi":149
* return node
*
* def contains(self, pattern): # <<<<<<<<<<<<<<
@@ -32228,7 +34022,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cd
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":164
+/* "cdec/sa/precomputation.pxi":164
* return True
*
* cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<<
@@ -32243,10 +34037,9 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("_contains", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":167
+ /* "cdec/sa/precomputation.pxi":167
* cdef int i
* cdef _Trie_Node* node
* node = self.root[pattern[0]] # <<<<<<<<<<<<<<
@@ -32255,7 +34048,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
*/
__pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":168
+ /* "cdec/sa/precomputation.pxi":168
* cdef _Trie_Node* node
* node = self.root[pattern[0]]
* i = 1 # <<<<<<<<<<<<<<
@@ -32264,7 +34057,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":169
+ /* "cdec/sa/precomputation.pxi":169
* node = self.root[pattern[0]]
* i = 1
* while node != NULL and i < pattern_len: # <<<<<<<<<<<<<<
@@ -32272,16 +34065,20 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
* i = i+1
*/
while (1) {
- __pyx_t_1 = ((__pyx_v_node != NULL) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i < __pyx_v_pattern_len) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_node != NULL) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L6_next_and;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (!__pyx_t_3) break;
+ __pyx_L6_next_and:;
+ __pyx_t_2 = ((__pyx_v_i < __pyx_v_pattern_len) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":170
+ /* "cdec/sa/precomputation.pxi":170
* i = 1
* while node != NULL and i < pattern_len:
* node = trie_find(node, pattern[i]) # <<<<<<<<<<<<<<
@@ -32290,7 +34087,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
*/
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":171
+ /* "cdec/sa/precomputation.pxi":171
* while node != NULL and i < pattern_len:
* node = trie_find(node, pattern[i])
* i = i+1 # <<<<<<<<<<<<<<
@@ -32300,7 +34097,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_v_i = (__pyx_v_i + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":172
+ /* "cdec/sa/precomputation.pxi":172
* node = trie_find(node, pattern[i])
* i = i+1
* return node # <<<<<<<<<<<<<<
@@ -32310,7 +34107,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
__pyx_r = __pyx_v_node;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":164
+ /* "cdec/sa/precomputation.pxi":164
* return True
*
* cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<<
@@ -32324,7 +34121,7 @@ static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_7TrieMap
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":174
+/* "cdec/sa/precomputation.pxi":174
* return node
*
* def toMap(self, flag): # <<<<<<<<<<<<<<
@@ -32360,7 +34157,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("toMap", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":177
+ /* "cdec/sa/precomputation.pxi":177
* cdef int i, include_zeros
*
* if flag: # <<<<<<<<<<<<<<
@@ -32370,7 +34167,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_flag); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":178
+ /* "cdec/sa/precomputation.pxi":178
*
* if flag:
* include_zeros=1 # <<<<<<<<<<<<<<
@@ -32382,7 +34179,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":180
+ /* "cdec/sa/precomputation.pxi":180
* include_zeros=1
* else:
* include_zeros=0 # <<<<<<<<<<<<<<
@@ -32393,7 +34190,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":181
+ /* "cdec/sa/precomputation.pxi":181
* else:
* include_zeros=0
* result = {} # <<<<<<<<<<<<<<
@@ -32405,7 +34202,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_v_result = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":182
+ /* "cdec/sa/precomputation.pxi":182
* include_zeros=0
* result = {}
* for i from 0 <= i < self.V: # <<<<<<<<<<<<<<
@@ -32415,7 +34212,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_t_3 = __pyx_v_self->V;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":183
+ /* "cdec/sa/precomputation.pxi":183
* result = {}
* for i from 0 <= i < self.V:
* if self.root[i] != NULL: # <<<<<<<<<<<<<<
@@ -32425,7 +34222,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_t_1 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":184
+ /* "cdec/sa/precomputation.pxi":184
* for i from 0 <= i < self.V:
* if self.root[i] != NULL:
* trie_node_to_map(self.root[i], result, (i,), include_zeros) # <<<<<<<<<<<<<<
@@ -32448,7 +34245,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_L6:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":185
+ /* "cdec/sa/precomputation.pxi":185
* if self.root[i] != NULL:
* trie_node_to_map(self.root[i], result, (i,), include_zeros)
* return result # <<<<<<<<<<<<<<
@@ -32460,7 +34257,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":174
+ /* "cdec/sa/precomputation.pxi":174
* return node
*
* def toMap(self, flag): # <<<<<<<<<<<<<<
@@ -32481,7 +34278,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":200
+/* "cdec/sa/precomputation.pxi":200
* cdef write_map(self, m, FILE* f)
*
* def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<<
@@ -32634,12 +34431,14 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ Py_ssize_t __pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":204
+ /* "cdec/sa/precomputation.pxi":204
* max_length=5, max_nonterminals=2,
* train_max_initial_size=10, train_min_gap_size=2):
* self.precompute_rank = precompute_rank # <<<<<<<<<<<<<<
@@ -32649,7 +34448,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_precompute_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->precompute_rank = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":205
+ /* "cdec/sa/precomputation.pxi":205
* train_max_initial_size=10, train_min_gap_size=2):
* self.precompute_rank = precompute_rank
* self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<<
@@ -32659,7 +34458,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_precompute_secondary_rank); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->precompute_secondary_rank = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":206
+ /* "cdec/sa/precomputation.pxi":206
* self.precompute_rank = precompute_rank
* self.precompute_secondary_rank = precompute_secondary_rank
* self.max_length = max_length # <<<<<<<<<<<<<<
@@ -32669,7 +34468,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_max_length); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->max_length = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":207
+ /* "cdec/sa/precomputation.pxi":207
* self.precompute_secondary_rank = precompute_secondary_rank
* self.max_length = max_length
* self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<<
@@ -32679,7 +34478,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_max_nonterminals); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->max_nonterminals = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":208
+ /* "cdec/sa/precomputation.pxi":208
* self.max_length = max_length
* self.max_nonterminals = max_nonterminals
* self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<<
@@ -32689,7 +34488,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_train_max_initial_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->train_max_initial_size = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":209
+ /* "cdec/sa/precomputation.pxi":209
* self.max_nonterminals = max_nonterminals
* self.train_max_initial_size = train_max_initial_size
* self.train_min_gap_size = train_min_gap_size # <<<<<<<<<<<<<<
@@ -32699,7 +34498,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_train_min_gap_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->train_min_gap_size = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":210
+ /* "cdec/sa/precomputation.pxi":210
* self.train_max_initial_size = train_max_initial_size
* self.train_min_gap_size = train_min_gap_size
* if from_binary: # <<<<<<<<<<<<<<
@@ -32709,29 +34508,45 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":211
+ /* "cdec/sa/precomputation.pxi":211
* self.train_min_gap_size = train_min_gap_size
* if from_binary:
* self.read_binary(from_binary) # <<<<<<<<<<<<<<
* elif from_stats:
* self.precompute(from_stats, fsarray)
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_from_binary);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_from_binary);
- __Pyx_GIVEREF(__pyx_v_from_binary);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_from_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_from_binary);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_from_binary);
+ __Pyx_GIVEREF(__pyx_v_from_binary);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":212
+ /* "cdec/sa/precomputation.pxi":212
* if from_binary:
* self.read_binary(from_binary)
* elif from_stats: # <<<<<<<<<<<<<<
@@ -32741,24 +34556,39 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_stats); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":213
+ /* "cdec/sa/precomputation.pxi":213
* self.read_binary(from_binary)
* elif from_stats:
* self.precompute(from_stats, fsarray) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_precompute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_precompute); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_6) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ }
__Pyx_INCREF(__pyx_v_from_stats);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_from_stats);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_from_stats);
__Pyx_GIVEREF(__pyx_v_from_stats);
__Pyx_INCREF(__pyx_v_fsarray);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_fsarray);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_fsarray);
__Pyx_GIVEREF(__pyx_v_fsarray);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -32767,7 +34597,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":200
+ /* "cdec/sa/precomputation.pxi":200
* cdef write_map(self, m, FILE* f)
*
* def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<<
@@ -32782,6 +34612,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -32789,7 +34620,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":216
+/* "cdec/sa/precomputation.pxi":216
*
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -32833,7 +34664,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":218
+ /* "cdec/sa/precomputation.pxi":218
* def read_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -32842,7 +34673,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":219
+ /* "cdec/sa/precomputation.pxi":219
* cdef FILE* f
* f = fopen(filename, "r")
* fread(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32851,7 +34682,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":220
+ /* "cdec/sa/precomputation.pxi":220
* f = fopen(filename, "r")
* fread(&(self.precompute_rank), sizeof(int), 1, f)
* fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32860,7 +34691,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":221
+ /* "cdec/sa/precomputation.pxi":221
* fread(&(self.precompute_rank), sizeof(int), 1, f)
* fread(&(self.precompute_secondary_rank), sizeof(int), 1, f)
* fread(&(self.max_length), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32869,7 +34700,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":222
+ /* "cdec/sa/precomputation.pxi":222
* fread(&(self.precompute_secondary_rank), sizeof(int), 1, f)
* fread(&(self.max_length), sizeof(int), 1, f)
* fread(&(self.max_nonterminals), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32878,7 +34709,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":223
+ /* "cdec/sa/precomputation.pxi":223
* fread(&(self.max_length), sizeof(int), 1, f)
* fread(&(self.max_nonterminals), sizeof(int), 1, f)
* fread(&(self.train_max_initial_size), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32887,7 +34718,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":224
+ /* "cdec/sa/precomputation.pxi":224
* fread(&(self.max_nonterminals), sizeof(int), 1, f)
* fread(&(self.train_max_initial_size), sizeof(int), 1, f)
* fread(&(self.train_min_gap_size), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -32896,7 +34727,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fread((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":225
+ /* "cdec/sa/precomputation.pxi":225
* fread(&(self.train_max_initial_size), sizeof(int), 1, f)
* fread(&(self.train_min_gap_size), sizeof(int), 1, f)
* self.precomputed_index = self.read_map(f) # <<<<<<<<<<<<<<
@@ -32911,7 +34742,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
__pyx_v_self->precomputed_index = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":226
+ /* "cdec/sa/precomputation.pxi":226
* fread(&(self.train_min_gap_size), sizeof(int), 1, f)
* self.precomputed_index = self.read_map(f)
* self.precomputed_collocations = self.read_map(f) # <<<<<<<<<<<<<<
@@ -32926,7 +34757,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
__pyx_v_self->precomputed_collocations = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":227
+ /* "cdec/sa/precomputation.pxi":227
* self.precomputed_index = self.read_map(f)
* self.precomputed_collocations = self.read_map(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -32935,7 +34766,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":216
+ /* "cdec/sa/precomputation.pxi":216
*
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -32956,7 +34787,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":230
+/* "cdec/sa/precomputation.pxi":230
*
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -33001,7 +34832,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":232
+ /* "cdec/sa/precomputation.pxi":232
* def write_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -33010,7 +34841,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":233
+ /* "cdec/sa/precomputation.pxi":233
* cdef FILE* f
* f = fopen(filename, "w")
* fwrite(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33019,7 +34850,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":234
+ /* "cdec/sa/precomputation.pxi":234
* f = fopen(filename, "w")
* fwrite(&(self.precompute_rank), sizeof(int), 1, f)
* fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33028,7 +34859,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":235
+ /* "cdec/sa/precomputation.pxi":235
* fwrite(&(self.precompute_rank), sizeof(int), 1, f)
* fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f)
* fwrite(&(self.max_length), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33037,7 +34868,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":236
+ /* "cdec/sa/precomputation.pxi":236
* fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f)
* fwrite(&(self.max_length), sizeof(int), 1, f)
* fwrite(&(self.max_nonterminals), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33046,7 +34877,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":237
+ /* "cdec/sa/precomputation.pxi":237
* fwrite(&(self.max_length), sizeof(int), 1, f)
* fwrite(&(self.max_nonterminals), sizeof(int), 1, f)
* fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33055,7 +34886,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":238
+ /* "cdec/sa/precomputation.pxi":238
* fwrite(&(self.max_nonterminals), sizeof(int), 1, f)
* fwrite(&(self.train_max_initial_size), sizeof(int), 1, f)
* fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33064,7 +34895,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fwrite((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":239
+ /* "cdec/sa/precomputation.pxi":239
* fwrite(&(self.train_max_initial_size), sizeof(int), 1, f)
* fwrite(&(self.train_min_gap_size), sizeof(int), 1, f)
* self.write_map(self.precomputed_index, f) # <<<<<<<<<<<<<<
@@ -33078,7 +34909,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":240
+ /* "cdec/sa/precomputation.pxi":240
* fwrite(&(self.train_min_gap_size), sizeof(int), 1, f)
* self.write_map(self.precomputed_index, f)
* self.write_map(self.precomputed_collocations, f) # <<<<<<<<<<<<<<
@@ -33092,7 +34923,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":241
+ /* "cdec/sa/precomputation.pxi":241
* self.write_map(self.precomputed_index, f)
* self.write_map(self.precomputed_collocations, f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -33101,7 +34932,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":230
+ /* "cdec/sa/precomputation.pxi":230
*
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -33123,7 +34954,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct _
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":244
+/* "cdec/sa/precomputation.pxi":244
*
*
* cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<<
@@ -33154,7 +34985,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_map", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":248
+ /* "cdec/sa/precomputation.pxi":248
* cdef IntList arr
*
* N = len(m) # <<<<<<<<<<<<<<
@@ -33164,7 +34995,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__pyx_t_1 = PyObject_Length(__pyx_v_m); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_N = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":249
+ /* "cdec/sa/precomputation.pxi":249
*
* N = len(m)
* fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33173,7 +35004,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
*/
fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":250
+ /* "cdec/sa/precomputation.pxi":250
* N = len(m)
* fwrite(&(N), sizeof(int), 1, f)
* for pattern, val in m.iteritems(): # <<<<<<<<<<<<<<
@@ -33201,7 +35032,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":251
+ /* "cdec/sa/precomputation.pxi":251
* fwrite(&(N), sizeof(int), 1, f)
* for pattern, val in m.iteritems():
* N = len(pattern) # <<<<<<<<<<<<<<
@@ -33211,7 +35042,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__pyx_t_8 = PyObject_Length(__pyx_v_pattern); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_N = __pyx_t_8;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":252
+ /* "cdec/sa/precomputation.pxi":252
* for pattern, val in m.iteritems():
* N = len(pattern)
* fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33220,36 +35051,38 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
*/
fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":253
+ /* "cdec/sa/precomputation.pxi":253
* N = len(pattern)
* fwrite(&(N), sizeof(int), 1, f)
* for word_id in pattern: # <<<<<<<<<<<<<<
* i = word_id
* fwrite(&(i), sizeof(int), 1, f)
*/
- if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
+ if (likely(PyList_CheckExact(__pyx_v_pattern)) || PyTuple_CheckExact(__pyx_v_pattern)) {
__pyx_t_6 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
__pyx_t_9 = NULL;
} else {
__pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
+ __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_6)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_6)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_9)) {
+ if (likely(PyList_CheckExact(__pyx_t_6))) {
+ if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_5 = __pyx_t_9(__pyx_t_6);
if (unlikely(!__pyx_t_5)) {
@@ -33265,7 +35098,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":254
+ /* "cdec/sa/precomputation.pxi":254
* fwrite(&(N), sizeof(int), 1, f)
* for word_id in pattern:
* i = word_id # <<<<<<<<<<<<<<
@@ -33275,7 +35108,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_word_id); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_i = __pyx_t_7;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":255
+ /* "cdec/sa/precomputation.pxi":255
* for word_id in pattern:
* i = word_id
* fwrite(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33283,10 +35116,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
* arr.write_handle(f)
*/
fwrite((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f);
+
+ /* "cdec/sa/precomputation.pxi":253
+ * N = len(pattern)
+ * fwrite(&(N), sizeof(int), 1, f)
+ * for word_id in pattern: # <<<<<<<<<<<<<<
+ * i = word_id
+ * fwrite(&(i), sizeof(int), 1, f)
+ */
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":256
+ /* "cdec/sa/precomputation.pxi":256
* i = word_id
* fwrite(&(i), sizeof(int), 1, f)
* arr = val # <<<<<<<<<<<<<<
@@ -33299,7 +35140,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
__Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_6));
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":257
+ /* "cdec/sa/precomputation.pxi":257
* fwrite(&(i), sizeof(int), 1, f)
* arr = val
* arr.write_handle(f) # <<<<<<<<<<<<<<
@@ -33310,7 +35151,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":244
+ /* "cdec/sa/precomputation.pxi":244
*
*
* cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<<
@@ -33337,7 +35178,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map(CYTHON_UNUSED
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":260
+/* "cdec/sa/precomputation.pxi":260
*
*
* cdef read_map(self, FILE* f): # <<<<<<<<<<<<<<
@@ -33365,7 +35206,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_map", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":264
+ /* "cdec/sa/precomputation.pxi":264
* cdef IntList arr
*
* m = {} # <<<<<<<<<<<<<<
@@ -33377,7 +35218,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__pyx_v_m = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":265
+ /* "cdec/sa/precomputation.pxi":265
*
* m = {}
* fread(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33386,7 +35227,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
*/
fread((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":266
+ /* "cdec/sa/precomputation.pxi":266
* m = {}
* fread(&(N), sizeof(int), 1, f)
* for j from 0 <= j < N: # <<<<<<<<<<<<<<
@@ -33396,7 +35237,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__pyx_t_2 = __pyx_v_N;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":267
+ /* "cdec/sa/precomputation.pxi":267
* fread(&(N), sizeof(int), 1, f)
* for j from 0 <= j < N:
* fread(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33405,7 +35246,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
*/
fread((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":268
+ /* "cdec/sa/precomputation.pxi":268
* for j from 0 <= j < N:
* fread(&(i), sizeof(int), 1, f)
* key = () # <<<<<<<<<<<<<<
@@ -33415,7 +35256,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__Pyx_INCREF(__pyx_empty_tuple);
__Pyx_XDECREF_SET(__pyx_v_key, __pyx_empty_tuple);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":269
+ /* "cdec/sa/precomputation.pxi":269
* fread(&(i), sizeof(int), 1, f)
* key = ()
* for k from 0 <= k < i: # <<<<<<<<<<<<<<
@@ -33425,7 +35266,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__pyx_t_3 = __pyx_v_i;
for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":270
+ /* "cdec/sa/precomputation.pxi":270
* key = ()
* for k from 0 <= k < i:
* fread(&(word_id), sizeof(int), 1, f) # <<<<<<<<<<<<<<
@@ -33434,7 +35275,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
*/
fread((&__pyx_v_word_id), (sizeof(int)), 1, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":271
+ /* "cdec/sa/precomputation.pxi":271
* for k from 0 <= k < i:
* fread(&(word_id), sizeof(int), 1, f)
* key = key + (word_id,) # <<<<<<<<<<<<<<
@@ -33455,7 +35296,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":272
+ /* "cdec/sa/precomputation.pxi":272
* fread(&(word_id), sizeof(int), 1, f)
* key = key + (word_id,)
* arr = IntList() # <<<<<<<<<<<<<<
@@ -33467,7 +35308,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__Pyx_XDECREF_SET(__pyx_v_arr, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":273
+ /* "cdec/sa/precomputation.pxi":273
* key = key + (word_id,)
* arr = IntList()
* arr.read_handle(f) # <<<<<<<<<<<<<<
@@ -33476,7 +35317,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":274
+ /* "cdec/sa/precomputation.pxi":274
* arr = IntList()
* arr.read_handle(f)
* m[key] = arr # <<<<<<<<<<<<<<
@@ -33486,7 +35327,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
if (unlikely(PyDict_SetItem(__pyx_v_m, __pyx_v_key, ((PyObject *)__pyx_v_arr)) < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":275
+ /* "cdec/sa/precomputation.pxi":275
* arr.read_handle(f)
* m[key] = arr
* return m # <<<<<<<<<<<<<<
@@ -33498,7 +35339,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
__pyx_r = __pyx_v_m;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":260
+ /* "cdec/sa/precomputation.pxi":260
*
*
* cdef read_map(self, FILE* f): # <<<<<<<<<<<<<<
@@ -33521,7 +35362,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map(CYTHON_UNUSED
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":278
+/* "cdec/sa/precomputation.pxi":278
*
*
* def precompute(self, stats, SuffixArray sarray): # <<<<<<<<<<<<<<
@@ -33650,9 +35491,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- float __pyx_t_4;
- PyObject *(*__pyx_t_5)(PyObject *);
- PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ float __pyx_t_5;
+ PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
PyObject *__pyx_t_9 = NULL;
@@ -33665,15 +35506,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
int __pyx_t_16;
int __pyx_t_17;
int __pyx_t_18;
- int __pyx_t_19;
- int __pyx_t_20;
- PyObject *(*__pyx_t_21)(PyObject *);
+ PyObject *(*__pyx_t_19)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("precompute", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":280
+ /* "cdec/sa/precomputation.pxi":280
* def precompute(self, stats, SuffixArray sarray):
* cdef int i, l, N, max_pattern_len, i1, l1, i2, l2, i3, l3, ptr1, ptr2, ptr3, is_super, sent_count, max_rank
* cdef DataArray darray = sarray.darray # <<<<<<<<<<<<<<
@@ -33685,7 +35524,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":285
+ /* "cdec/sa/precomputation.pxi":285
* cdef _Trie_Node* node
*
* data = darray.data # <<<<<<<<<<<<<<
@@ -33697,7 +35536,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":287
+ /* "cdec/sa/precomputation.pxi":287
* data = darray.data
*
* frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<<
@@ -33721,7 +35560,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":288
+ /* "cdec/sa/precomputation.pxi":288
*
* frequent_patterns = TrieMap(len(darray.id2word))
* super_frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<<
@@ -33745,7 +35584,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_super_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":289
+ /* "cdec/sa/precomputation.pxi":289
* frequent_patterns = TrieMap(len(darray.id2word))
* super_frequent_patterns = TrieMap(len(darray.id2word))
* collocations = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<<
@@ -33769,7 +35608,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_collocations = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":291
+ /* "cdec/sa/precomputation.pxi":291
* collocations = TrieMap(len(darray.id2word))
*
* I_set = set() # <<<<<<<<<<<<<<
@@ -33781,7 +35620,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_I_set = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":292
+ /* "cdec/sa/precomputation.pxi":292
*
* I_set = set()
* J_set = set() # <<<<<<<<<<<<<<
@@ -33793,7 +35632,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_J_set = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":293
+ /* "cdec/sa/precomputation.pxi":293
* I_set = set()
* J_set = set()
* J2_set = set() # <<<<<<<<<<<<<<
@@ -33805,7 +35644,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_J2_set = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":294
+ /* "cdec/sa/precomputation.pxi":294
* J_set = set()
* J2_set = set()
* IJ_set = set() # <<<<<<<<<<<<<<
@@ -33817,7 +35656,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_IJ_set = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":295
+ /* "cdec/sa/precomputation.pxi":295
* J2_set = set()
* IJ_set = set()
* pattern_rank = {} # <<<<<<<<<<<<<<
@@ -33829,7 +35668,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_pattern_rank = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297
+ /* "cdec/sa/precomputation.pxi":297
* pattern_rank = {}
*
* logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<<
@@ -33846,23 +35685,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":298
+ /* "cdec/sa/precomputation.pxi":298
*
* logger.info("Precomputing frequent intersections")
* cdef float start_time = monitor_cpu() # <<<<<<<<<<<<<<
*
* max_pattern_len = 0
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_start_time = __pyx_t_4;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_start_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":300
+ /* "cdec/sa/precomputation.pxi":300
* cdef float start_time = monitor_cpu()
*
* max_pattern_len = 0 # <<<<<<<<<<<<<<
@@ -33871,7 +35725,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_max_pattern_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":301
+ /* "cdec/sa/precomputation.pxi":301
*
* max_pattern_len = 0
* for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<<
@@ -33879,33 +35733,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
* break
*/
__Pyx_INCREF(__pyx_int_0);
- __pyx_t_3 = __pyx_int_0;
- if (PyList_CheckExact(__pyx_v_stats) || PyTuple_CheckExact(__pyx_v_stats)) {
- __pyx_t_1 = __pyx_v_stats; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
- __pyx_t_5 = NULL;
+ __pyx_t_1 = __pyx_int_0;
+ if (likely(PyList_CheckExact(__pyx_v_stats)) || PyTuple_CheckExact(__pyx_v_stats)) {
+ __pyx_t_3 = __pyx_v_stats; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
+ __pyx_t_6 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_stats); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_stats); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_6 = __pyx_t_5(__pyx_t_1);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -33913,10 +35769,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_4);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
- PyObject* sequence = __pyx_t_6;
+ if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+ PyObject* sequence = __pyx_t_4;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -33948,12 +35804,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
#endif
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_7);
@@ -33978,30 +35834,30 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_8 = 0;
__Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_9);
__pyx_t_9 = 0;
- __Pyx_INCREF(__pyx_t_3);
- __Pyx_XDECREF_SET(__pyx_v_rank, __pyx_t_3);
- __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3);
- __pyx_t_3 = __pyx_t_6;
- __pyx_t_6 = 0;
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_v_rank, __pyx_t_1);
+ __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":302
+ /* "cdec/sa/precomputation.pxi":302
* max_pattern_len = 0
* for rank, (_, _, phrase) in enumerate(stats):
* if rank >= self.precompute_rank: # <<<<<<<<<<<<<<
* break
* max_pattern_len = max(max_pattern_len, len(phrase))
*/
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->precompute_rank); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_6, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->precompute_rank); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_9 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":303
+ /* "cdec/sa/precomputation.pxi":303
* for rank, (_, _, phrase) in enumerate(stats):
* if rank >= self.precompute_rank:
* break # <<<<<<<<<<<<<<
@@ -34011,7 +35867,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
goto __pyx_L4_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":304
+ /* "cdec/sa/precomputation.pxi":304
* if rank >= self.precompute_rank:
* break
* max_pattern_len = max(max_pattern_len, len(phrase)) # <<<<<<<<<<<<<<
@@ -34027,27 +35883,43 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
__pyx_v_max_pattern_len = __pyx_t_15;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":305
+ /* "cdec/sa/precomputation.pxi":305
* break
* max_pattern_len = max(max_pattern_len, len(phrase))
* frequent_patterns.insert(phrase) # <<<<<<<<<<<<<<
* I_set.add(phrase)
* pattern_rank[phrase] = rank
*/
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s_insert); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(__pyx_v_phrase);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_phrase);
- __Pyx_GIVEREF(__pyx_v_phrase);
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s_insert); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_phrase); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ __Pyx_INCREF(__pyx_v_phrase);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_phrase);
+ __Pyx_GIVEREF(__pyx_v_phrase);
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":306
+ /* "cdec/sa/precomputation.pxi":306
* max_pattern_len = max(max_pattern_len, len(phrase))
* frequent_patterns.insert(phrase)
* I_set.add(phrase) # <<<<<<<<<<<<<<
@@ -34056,7 +35928,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_16 = PySet_Add(__pyx_v_I_set, __pyx_v_phrase); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":307
+ /* "cdec/sa/precomputation.pxi":307
* frequent_patterns.insert(phrase)
* I_set.add(phrase)
* pattern_rank[phrase] = rank # <<<<<<<<<<<<<<
@@ -34065,42 +35937,58 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
if (unlikely(PyDict_SetItem(__pyx_v_pattern_rank, __pyx_v_phrase, __pyx_v_rank) < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":308
+ /* "cdec/sa/precomputation.pxi":308
* I_set.add(phrase)
* pattern_rank[phrase] = rank
* if rank < self.precompute_secondary_rank: # <<<<<<<<<<<<<<
* super_frequent_patterns.insert(phrase)
* J_set.add(phrase)
*/
- __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->precompute_secondary_rank); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_6 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->precompute_secondary_rank); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_rank, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":309
+ /* "cdec/sa/precomputation.pxi":309
* pattern_rank[phrase] = rank
* if rank < self.precompute_secondary_rank:
* super_frequent_patterns.insert(phrase) # <<<<<<<<<<<<<<
* J_set.add(phrase)
*
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_super_frequent_patterns), __pyx_n_s_insert); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_INCREF(__pyx_v_phrase);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_phrase);
- __Pyx_GIVEREF(__pyx_v_phrase);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_super_frequent_patterns), __pyx_n_s_insert); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_phrase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_v_phrase);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_phrase);
+ __Pyx_GIVEREF(__pyx_v_phrase);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":310
+ /* "cdec/sa/precomputation.pxi":310
* if rank < self.precompute_secondary_rank:
* super_frequent_patterns.insert(phrase)
* J_set.add(phrase) # <<<<<<<<<<<<<<
@@ -34111,45 +35999,53 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
goto __pyx_L8;
}
__pyx_L8:;
+
+ /* "cdec/sa/precomputation.pxi":301
+ *
+ * max_pattern_len = 0
+ * for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<<
+ * if rank >= self.precompute_rank:
+ * break
+ */
}
__pyx_L4_break:;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":312
+ /* "cdec/sa/precomputation.pxi":312
* J_set.add(phrase)
*
* queue = IntList(increment=1000) # <<<<<<<<<<<<<<
*
* logger.info(" Computing inverted indexes...")
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_increment, __pyx_int_1000) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_queue = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
- __pyx_t_1 = 0;
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_increment, __pyx_int_1000) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_v_queue = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314
+ /* "cdec/sa/precomputation.pxi":314
* queue = IntList(increment=1000)
*
* logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<<
* N = len(data)
* for i from 0 <= i < N:
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":315
+ /* "cdec/sa/precomputation.pxi":315
*
* logger.info(" Computing inverted indexes...")
* N = len(data) # <<<<<<<<<<<<<<
@@ -34159,7 +36055,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_data)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_N = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":316
+ /* "cdec/sa/precomputation.pxi":316
* logger.info(" Computing inverted indexes...")
* N = len(data)
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
@@ -34169,7 +36065,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_14 = __pyx_v_N;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":317
+ /* "cdec/sa/precomputation.pxi":317
* N = len(data)
* for i from 0 <= i < N:
* sa_word_id = data.arr[i] # <<<<<<<<<<<<<<
@@ -34178,7 +36074,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_sa_word_id = (__pyx_v_data->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":318
+ /* "cdec/sa/precomputation.pxi":318
* for i from 0 <= i < N:
* sa_word_id = data.arr[i]
* if sa_word_id == 1: # <<<<<<<<<<<<<<
@@ -34188,7 +36084,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_sa_word_id == 1) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":319
+ /* "cdec/sa/precomputation.pxi":319
* sa_word_id = data.arr[i]
* if sa_word_id == 1:
* queue._append(-1) # <<<<<<<<<<<<<<
@@ -34200,7 +36096,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":321
+ /* "cdec/sa/precomputation.pxi":321
* queue._append(-1)
* else:
* for l from 1 <= l <= max_pattern_len: # <<<<<<<<<<<<<<
@@ -34210,7 +36106,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_17 = __pyx_v_max_pattern_len;
for (__pyx_v_l = 1; __pyx_v_l <= __pyx_t_17; __pyx_v_l++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":322
+ /* "cdec/sa/precomputation.pxi":322
* else:
* for l from 1 <= l <= max_pattern_len:
* node = frequent_patterns._contains(data.arr+i, l) # <<<<<<<<<<<<<<
@@ -34219,7 +36115,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i), __pyx_v_l);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":323
+ /* "cdec/sa/precomputation.pxi":323
* for l from 1 <= l <= max_pattern_len:
* node = frequent_patterns._contains(data.arr+i, l)
* if node == NULL: # <<<<<<<<<<<<<<
@@ -34229,7 +36125,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_node == NULL) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":324
+ /* "cdec/sa/precomputation.pxi":324
* node = frequent_patterns._contains(data.arr+i, l)
* if node == NULL:
* break # <<<<<<<<<<<<<<
@@ -34239,7 +36135,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
goto __pyx_L13_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":325
+ /* "cdec/sa/precomputation.pxi":325
* if node == NULL:
* break
* queue._append(i) # <<<<<<<<<<<<<<
@@ -34248,7 +36144,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":326
+ /* "cdec/sa/precomputation.pxi":326
* break
* queue._append(i)
* queue._append(l) # <<<<<<<<<<<<<<
@@ -34257,40 +36153,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":327
+ /* "cdec/sa/precomputation.pxi":327
* queue._append(i)
* queue._append(l)
* trie_node_data_append(node, i) # <<<<<<<<<<<<<<
*
* logger.info(" Computing collocations...")
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L13_break:;
}
__pyx_L11:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329
+ /* "cdec/sa/precomputation.pxi":329
* trie_node_data_append(node, i)
*
* logger.info(" Computing collocations...") # <<<<<<<<<<<<<<
* N = len(queue)
* ptr1 = 0
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":330
+ /* "cdec/sa/precomputation.pxi":330
*
* logger.info(" Computing collocations...")
* N = len(queue) # <<<<<<<<<<<<<<
@@ -34300,7 +36196,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_queue)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_N = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":331
+ /* "cdec/sa/precomputation.pxi":331
* logger.info(" Computing collocations...")
* N = len(queue)
* ptr1 = 0 # <<<<<<<<<<<<<<
@@ -34309,7 +36205,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_ptr1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":332
+ /* "cdec/sa/precomputation.pxi":332
* N = len(queue)
* ptr1 = 0
* sent_count = 0 # <<<<<<<<<<<<<<
@@ -34318,7 +36214,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_sent_count = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":333
+ /* "cdec/sa/precomputation.pxi":333
* ptr1 = 0
* sent_count = 0
* while ptr1 < N: # main loop # <<<<<<<<<<<<<<
@@ -34329,7 +36225,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_ptr1 < __pyx_v_N) != 0);
if (!__pyx_t_12) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":334
+ /* "cdec/sa/precomputation.pxi":334
* sent_count = 0
* while ptr1 < N: # main loop
* i1 = queue.arr[ptr1] # <<<<<<<<<<<<<<
@@ -34338,7 +36234,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_i1 = (__pyx_v_queue->arr[__pyx_v_ptr1]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":335
+ /* "cdec/sa/precomputation.pxi":335
* while ptr1 < N: # main loop
* i1 = queue.arr[ptr1]
* if i1 > -1: # <<<<<<<<<<<<<<
@@ -34348,7 +36244,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_i1 > -1) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":336
+ /* "cdec/sa/precomputation.pxi":336
* i1 = queue.arr[ptr1]
* if i1 > -1:
* l1 = queue.arr[ptr1+1] # <<<<<<<<<<<<<<
@@ -34357,7 +36253,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_l1 = (__pyx_v_queue->arr[(__pyx_v_ptr1 + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":337
+ /* "cdec/sa/precomputation.pxi":337
* if i1 > -1:
* l1 = queue.arr[ptr1+1]
* ptr2 = ptr1 + 2 # <<<<<<<<<<<<<<
@@ -34366,7 +36262,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_ptr2 = (__pyx_v_ptr1 + 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":338
+ /* "cdec/sa/precomputation.pxi":338
* l1 = queue.arr[ptr1+1]
* ptr2 = ptr1 + 2
* while ptr2 < N: # <<<<<<<<<<<<<<
@@ -34377,7 +36273,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_ptr2 < __pyx_v_N) != 0);
if (!__pyx_t_12) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":339
+ /* "cdec/sa/precomputation.pxi":339
* ptr2 = ptr1 + 2
* while ptr2 < N:
* i2 = queue.arr[ptr2] # <<<<<<<<<<<<<<
@@ -34386,23 +36282,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_i2 = (__pyx_v_queue->arr[__pyx_v_ptr2]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":340
+ /* "cdec/sa/precomputation.pxi":340
* while ptr2 < N:
* i2 = queue.arr[ptr2]
* if i2 == -1 or i2 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<<
* break
* l2 = queue.arr[ptr2+1]
*/
- __pyx_t_12 = ((__pyx_v_i2 == -1) != 0);
- if (!__pyx_t_12) {
- __pyx_t_18 = (((__pyx_v_i2 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_19 = __pyx_t_18;
+ __pyx_t_18 = ((__pyx_v_i2 == -1) != 0);
+ if (!__pyx_t_18) {
+ goto __pyx_L22_next_or;
} else {
- __pyx_t_19 = __pyx_t_12;
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L21_bool_binop_done;
}
- if (__pyx_t_19) {
+ __pyx_L22_next_or:;
+ __pyx_t_18 = (((__pyx_v_i2 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_12 = __pyx_t_18;
+ __pyx_L21_bool_binop_done:;
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":341
+ /* "cdec/sa/precomputation.pxi":341
* i2 = queue.arr[ptr2]
* if i2 == -1 or i2 - i1 >= self.train_max_initial_size:
* break # <<<<<<<<<<<<<<
@@ -34412,7 +36312,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
goto __pyx_L19_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":342
+ /* "cdec/sa/precomputation.pxi":342
* if i2 == -1 or i2 - i1 >= self.train_max_initial_size:
* break
* l2 = queue.arr[ptr2+1] # <<<<<<<<<<<<<<
@@ -34421,45 +36321,51 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_l2 = (__pyx_v_queue->arr[(__pyx_v_ptr2 + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":343
+ /* "cdec/sa/precomputation.pxi":343
* break
* l2 = queue.arr[ptr2+1]
* if (i2 - i1 - l1 >= self.train_min_gap_size and # <<<<<<<<<<<<<<
* i2 + l2 - i1 <= self.train_max_initial_size and
* l1+l2+1 <= self.max_length):
*/
- __pyx_t_19 = ((((__pyx_v_i2 - __pyx_v_i1) - __pyx_v_l1) >= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_19) {
+ __pyx_t_18 = ((((__pyx_v_i2 - __pyx_v_i1) - __pyx_v_l1) >= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_18) {
+ goto __pyx_L25_next_and;
+ } else {
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L24_bool_binop_done;
+ }
+ __pyx_L25_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":344
+ /* "cdec/sa/precomputation.pxi":344
* l2 = queue.arr[ptr2+1]
* if (i2 - i1 - l1 >= self.train_min_gap_size and
* i2 + l2 - i1 <= self.train_max_initial_size and # <<<<<<<<<<<<<<
* l1+l2+1 <= self.max_length):
* node = collocations._insert(data.arr+i1, l1)
*/
- __pyx_t_12 = ((((__pyx_v_i2 + __pyx_v_l2) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_12) {
+ __pyx_t_18 = ((((__pyx_v_i2 + __pyx_v_l2) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_18) {
+ goto __pyx_L26_next_and;
+ } else {
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L24_bool_binop_done;
+ }
+ __pyx_L26_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":345
+ /* "cdec/sa/precomputation.pxi":345
* if (i2 - i1 - l1 >= self.train_min_gap_size and
* i2 + l2 - i1 <= self.train_max_initial_size and
* l1+l2+1 <= self.max_length): # <<<<<<<<<<<<<<
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1)
*/
- __pyx_t_18 = ((((__pyx_v_l1 + __pyx_v_l2) + 1) <= __pyx_v_self->max_length) != 0);
- __pyx_t_20 = __pyx_t_18;
- } else {
- __pyx_t_20 = __pyx_t_12;
- }
- __pyx_t_12 = __pyx_t_20;
- } else {
- __pyx_t_12 = __pyx_t_19;
- }
+ __pyx_t_18 = ((((__pyx_v_l1 + __pyx_v_l2) + 1) <= __pyx_v_self->max_length) != 0);
+ __pyx_t_12 = __pyx_t_18;
+ __pyx_L24_bool_binop_done:;
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":346
+ /* "cdec/sa/precomputation.pxi":346
* i2 + l2 - i1 <= self.train_max_initial_size and
* l1+l2+1 <= self.max_length):
* node = collocations._insert(data.arr+i1, l1) # <<<<<<<<<<<<<<
@@ -34468,7 +36374,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":347
+ /* "cdec/sa/precomputation.pxi":347
* l1+l2+1 <= self.max_length):
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1) # <<<<<<<<<<<<<<
@@ -34477,7 +36383,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":348
+ /* "cdec/sa/precomputation.pxi":348
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1)
* for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<<
@@ -34487,7 +36393,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_14 = (__pyx_v_i2 + __pyx_v_l2);
for (__pyx_v_i = __pyx_v_i2; __pyx_v_i < __pyx_t_14; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":349
+ /* "cdec/sa/precomputation.pxi":349
* node = trie_insert(node, -1)
* for i from i2 <= i < i2+l2:
* node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<<
@@ -34497,29 +36403,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i]));
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":350
+ /* "cdec/sa/precomputation.pxi":350
* for i from i2 <= i < i2+l2:
* node = trie_insert(node, data.arr[i])
* trie_node_data_append(node, i1) # <<<<<<<<<<<<<<
* trie_node_data_append(node, i2)
* if super_frequent_patterns._contains(data.arr+i2, l2) != NULL:
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":351
+ /* "cdec/sa/precomputation.pxi":351
* node = trie_insert(node, data.arr[i])
* trie_node_data_append(node, i1)
* trie_node_data_append(node, i2) # <<<<<<<<<<<<<<
* if super_frequent_patterns._contains(data.arr+i2, l2) != NULL:
* if super_frequent_patterns._contains(data.arr+i1, l1) != NULL:
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":352
+ /* "cdec/sa/precomputation.pxi":352
* trie_node_data_append(node, i1)
* trie_node_data_append(node, i2)
* if super_frequent_patterns._contains(data.arr+i2, l2) != NULL: # <<<<<<<<<<<<<<
@@ -34529,7 +36435,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i2), __pyx_v_l2) != NULL) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":353
+ /* "cdec/sa/precomputation.pxi":353
* trie_node_data_append(node, i2)
* if super_frequent_patterns._contains(data.arr+i2, l2) != NULL:
* if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: # <<<<<<<<<<<<<<
@@ -34539,7 +36445,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1) != NULL) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":354
+ /* "cdec/sa/precomputation.pxi":354
* if super_frequent_patterns._contains(data.arr+i2, l2) != NULL:
* if super_frequent_patterns._contains(data.arr+i1, l1) != NULL:
* is_super = 1 # <<<<<<<<<<<<<<
@@ -34547,11 +36453,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
* is_super = 0
*/
__pyx_v_is_super = 1;
- goto __pyx_L25;
+ goto __pyx_L30;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":356
+ /* "cdec/sa/precomputation.pxi":356
* is_super = 1
* else:
* is_super = 0 # <<<<<<<<<<<<<<
@@ -34560,9 +36466,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_is_super = 0;
}
- __pyx_L25:;
+ __pyx_L30:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":357
+ /* "cdec/sa/precomputation.pxi":357
* else:
* is_super = 0
* ptr3 = ptr2 + 2 # <<<<<<<<<<<<<<
@@ -34571,7 +36477,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_ptr3 = (__pyx_v_ptr2 + 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":358
+ /* "cdec/sa/precomputation.pxi":358
* is_super = 0
* ptr3 = ptr2 + 2
* while ptr3 < N: # <<<<<<<<<<<<<<
@@ -34582,7 +36488,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_12 = ((__pyx_v_ptr3 < __pyx_v_N) != 0);
if (!__pyx_t_12) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":359
+ /* "cdec/sa/precomputation.pxi":359
* ptr3 = ptr2 + 2
* while ptr3 < N:
* i3 = queue.arr[ptr3] # <<<<<<<<<<<<<<
@@ -34591,33 +36497,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_i3 = (__pyx_v_queue->arr[__pyx_v_ptr3]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":360
+ /* "cdec/sa/precomputation.pxi":360
* while ptr3 < N:
* i3 = queue.arr[ptr3]
* if i3 == -1 or i3 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<<
* break
* l3 = queue.arr[ptr3+1]
*/
- __pyx_t_12 = ((__pyx_v_i3 == -1) != 0);
- if (!__pyx_t_12) {
- __pyx_t_19 = (((__pyx_v_i3 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_20 = __pyx_t_19;
+ __pyx_t_18 = ((__pyx_v_i3 == -1) != 0);
+ if (!__pyx_t_18) {
+ goto __pyx_L35_next_or;
} else {
- __pyx_t_20 = __pyx_t_12;
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L34_bool_binop_done;
}
- if (__pyx_t_20) {
+ __pyx_L35_next_or:;
+ __pyx_t_18 = (((__pyx_v_i3 - __pyx_v_i1) >= __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_12 = __pyx_t_18;
+ __pyx_L34_bool_binop_done:;
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":361
+ /* "cdec/sa/precomputation.pxi":361
* i3 = queue.arr[ptr3]
* if i3 == -1 or i3 - i1 >= self.train_max_initial_size:
* break # <<<<<<<<<<<<<<
* l3 = queue.arr[ptr3+1]
* if (i3 - i2 - l2 >= self.train_min_gap_size and
*/
- goto __pyx_L27_break;
+ goto __pyx_L32_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":362
+ /* "cdec/sa/precomputation.pxi":362
* if i3 == -1 or i3 - i1 >= self.train_max_initial_size:
* break
* l3 = queue.arr[ptr3+1] # <<<<<<<<<<<<<<
@@ -34626,60 +36536,71 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_l3 = (__pyx_v_queue->arr[(__pyx_v_ptr3 + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":363
+ /* "cdec/sa/precomputation.pxi":363
* break
* l3 = queue.arr[ptr3+1]
* if (i3 - i2 - l2 >= self.train_min_gap_size and # <<<<<<<<<<<<<<
* i3 + l3 - i1 <= self.train_max_initial_size and
* l1+l2+l3+2 <= self.max_length):
*/
- __pyx_t_20 = ((((__pyx_v_i3 - __pyx_v_i2) - __pyx_v_l2) >= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_20) {
+ __pyx_t_18 = ((((__pyx_v_i3 - __pyx_v_i2) - __pyx_v_l2) >= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_18) {
+ goto __pyx_L38_next_and;
+ } else {
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L37_bool_binop_done;
+ }
+ __pyx_L38_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":364
+ /* "cdec/sa/precomputation.pxi":364
* l3 = queue.arr[ptr3+1]
* if (i3 - i2 - l2 >= self.train_min_gap_size and
* i3 + l3 - i1 <= self.train_max_initial_size and # <<<<<<<<<<<<<<
* l1+l2+l3+2 <= self.max_length):
* if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL:
*/
- __pyx_t_12 = ((((__pyx_v_i3 + __pyx_v_l3) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_12) {
+ __pyx_t_18 = ((((__pyx_v_i3 + __pyx_v_l3) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_18) {
+ goto __pyx_L39_next_and;
+ } else {
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L37_bool_binop_done;
+ }
+ __pyx_L39_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":365
+ /* "cdec/sa/precomputation.pxi":365
* if (i3 - i2 - l2 >= self.train_min_gap_size and
* i3 + l3 - i1 <= self.train_max_initial_size and
* l1+l2+l3+2 <= self.max_length): # <<<<<<<<<<<<<<
* if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL:
* node = collocations._insert(data.arr+i1, l1)
*/
- __pyx_t_19 = (((((__pyx_v_l1 + __pyx_v_l2) + __pyx_v_l3) + 2) <= __pyx_v_self->max_length) != 0);
- __pyx_t_18 = __pyx_t_19;
- } else {
- __pyx_t_18 = __pyx_t_12;
- }
- __pyx_t_12 = __pyx_t_18;
- } else {
- __pyx_t_12 = __pyx_t_20;
- }
+ __pyx_t_18 = (((((__pyx_v_l1 + __pyx_v_l2) + __pyx_v_l3) + 2) <= __pyx_v_self->max_length) != 0);
+ __pyx_t_12 = __pyx_t_18;
+ __pyx_L37_bool_binop_done:;
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":366
+ /* "cdec/sa/precomputation.pxi":366
* i3 + l3 - i1 <= self.train_max_initial_size and
* l1+l2+l3+2 <= self.max_length):
* if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL: # <<<<<<<<<<<<<<
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1)
*/
- if (!(__pyx_v_is_super != 0)) {
- __pyx_t_12 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i3), __pyx_v_l3) != NULL);
- __pyx_t_20 = __pyx_t_12;
+ __pyx_t_18 = (__pyx_v_is_super != 0);
+ if (!__pyx_t_18) {
+ goto __pyx_L42_next_or;
} else {
- __pyx_t_20 = (__pyx_v_is_super != 0);
+ __pyx_t_12 = __pyx_t_18;
+ goto __pyx_L41_bool_binop_done;
}
- if (__pyx_t_20) {
+ __pyx_L42_next_or:;
+ __pyx_t_18 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_super_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_super_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i3), __pyx_v_l3) != NULL) != 0);
+ __pyx_t_12 = __pyx_t_18;
+ __pyx_L41_bool_binop_done:;
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":367
+ /* "cdec/sa/precomputation.pxi":367
* l1+l2+l3+2 <= self.max_length):
* if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL:
* node = collocations._insert(data.arr+i1, l1) # <<<<<<<<<<<<<<
@@ -34688,7 +36609,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":368
+ /* "cdec/sa/precomputation.pxi":368
* if is_super or super_frequent_patterns._contains(data.arr+i3, l3) != NULL:
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1) # <<<<<<<<<<<<<<
@@ -34697,7 +36618,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":369
+ /* "cdec/sa/precomputation.pxi":369
* node = collocations._insert(data.arr+i1, l1)
* node = trie_insert(node, -1)
* for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<<
@@ -34707,7 +36628,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_14 = (__pyx_v_i2 + __pyx_v_l2);
for (__pyx_v_i = __pyx_v_i2; __pyx_v_i < __pyx_t_14; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":370
+ /* "cdec/sa/precomputation.pxi":370
* node = trie_insert(node, -1)
* for i from i2 <= i < i2+l2:
* node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<<
@@ -34717,7 +36638,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i]));
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":371
+ /* "cdec/sa/precomputation.pxi":371
* for i from i2 <= i < i2+l2:
* node = trie_insert(node, data.arr[i])
* node = trie_insert(node, -1) # <<<<<<<<<<<<<<
@@ -34726,7 +36647,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":372
+ /* "cdec/sa/precomputation.pxi":372
* node = trie_insert(node, data.arr[i])
* node = trie_insert(node, -1)
* for i from i3 <= i < i3+l3: # <<<<<<<<<<<<<<
@@ -34736,7 +36657,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_14 = (__pyx_v_i3 + __pyx_v_l3);
for (__pyx_v_i = __pyx_v_i3; __pyx_v_i < __pyx_t_14; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":373
+ /* "cdec/sa/precomputation.pxi":373
* node = trie_insert(node, -1)
* for i from i3 <= i < i3+l3:
* node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<<
@@ -34746,46 +36667,46 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i]));
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":374
+ /* "cdec/sa/precomputation.pxi":374
* for i from i3 <= i < i3+l3:
* node = trie_insert(node, data.arr[i])
* trie_node_data_append(node, i1) # <<<<<<<<<<<<<<
* trie_node_data_append(node, i2)
* trie_node_data_append(node, i3)
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":375
+ /* "cdec/sa/precomputation.pxi":375
* node = trie_insert(node, data.arr[i])
* trie_node_data_append(node, i1)
* trie_node_data_append(node, i2) # <<<<<<<<<<<<<<
* trie_node_data_append(node, i3)
* ptr3 = ptr3 + 2
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":376
+ /* "cdec/sa/precomputation.pxi":376
* trie_node_data_append(node, i1)
* trie_node_data_append(node, i2)
* trie_node_data_append(node, i3) # <<<<<<<<<<<<<<
* ptr3 = ptr3 + 2
* ptr2 = ptr2 + 2
*/
- __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L30;
+ __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_node_data_append(__pyx_v_node, __pyx_v_i3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L40;
}
- __pyx_L30:;
- goto __pyx_L29;
+ __pyx_L40:;
+ goto __pyx_L36;
}
- __pyx_L29:;
+ __pyx_L36:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":377
+ /* "cdec/sa/precomputation.pxi":377
* trie_node_data_append(node, i2)
* trie_node_data_append(node, i3)
* ptr3 = ptr3 + 2 # <<<<<<<<<<<<<<
@@ -34794,15 +36715,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_ptr3 = (__pyx_v_ptr3 + 2);
}
- __pyx_L27_break:;
- goto __pyx_L24;
+ __pyx_L32_break:;
+ goto __pyx_L29;
}
- __pyx_L24:;
- goto __pyx_L21;
+ __pyx_L29:;
+ goto __pyx_L23;
}
- __pyx_L21:;
+ __pyx_L23:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":378
+ /* "cdec/sa/precomputation.pxi":378
* trie_node_data_append(node, i3)
* ptr3 = ptr3 + 2
* ptr2 = ptr2 + 2 # <<<<<<<<<<<<<<
@@ -34813,7 +36734,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
__pyx_L19_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":379
+ /* "cdec/sa/precomputation.pxi":379
* ptr3 = ptr3 + 2
* ptr2 = ptr2 + 2
* ptr1 = ptr1 + 2 # <<<<<<<<<<<<<<
@@ -34825,7 +36746,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":381
+ /* "cdec/sa/precomputation.pxi":381
* ptr1 = ptr1 + 2
* else:
* sent_count = sent_count + 1 # <<<<<<<<<<<<<<
@@ -34834,17 +36755,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_sent_count = (__pyx_v_sent_count + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":382
+ /* "cdec/sa/precomputation.pxi":382
* else:
* sent_count = sent_count + 1
* if sent_count % 10000 == 0: # <<<<<<<<<<<<<<
* logger.debug(" %d sentences", sent_count)
* ptr1 = ptr1 + 1
*/
- __pyx_t_20 = ((__Pyx_mod_long(__pyx_v_sent_count, 10000) == 0) != 0);
- if (__pyx_t_20) {
+ __pyx_t_12 = ((__Pyx_mod_long(__pyx_v_sent_count, 10000) == 0) != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":383
+ /* "cdec/sa/precomputation.pxi":383
* sent_count = sent_count + 1
* if sent_count % 10000 == 0:
* logger.debug(" %d sentences", sent_count) # <<<<<<<<<<<<<<
@@ -34853,29 +36774,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_sent_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_9 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_9) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_d_sentences);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_s_d_sentences);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_2, __pyx_kp_s_d_sentences);
__Pyx_GIVEREF(__pyx_kp_s_d_sentences);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_2, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L35;
+ goto __pyx_L47;
}
- __pyx_L35:;
+ __pyx_L47:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":384
+ /* "cdec/sa/precomputation.pxi":384
* if sent_count % 10000 == 0:
* logger.debug(" %d sentences", sent_count)
* ptr1 = ptr1 + 1 # <<<<<<<<<<<<<<
@@ -34887,43 +36823,43 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_L17:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":386
+ /* "cdec/sa/precomputation.pxi":386
* ptr1 = ptr1 + 1
*
* self.precomputed_collocations = collocations.toMap(False) # <<<<<<<<<<<<<<
* self.precomputed_index = frequent_patterns.toMap(True)
*
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_collocations), __pyx_n_s_toMap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_collocations), __pyx_n_s_toMap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->precomputed_collocations);
__Pyx_DECREF(__pyx_v_self->precomputed_collocations);
- __pyx_v_self->precomputed_collocations = __pyx_t_9;
- __pyx_t_9 = 0;
+ __pyx_v_self->precomputed_collocations = __pyx_t_4;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":387
+ /* "cdec/sa/precomputation.pxi":387
*
* self.precomputed_collocations = collocations.toMap(False)
* self.precomputed_index = frequent_patterns.toMap(True) # <<<<<<<<<<<<<<
*
* x = 0
*/
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s_toMap); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_frequent_patterns), __pyx_n_s_toMap); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_v_self->precomputed_index);
__Pyx_DECREF(__pyx_v_self->precomputed_index);
- __pyx_v_self->precomputed_index = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_v_self->precomputed_index = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":389
+ /* "cdec/sa/precomputation.pxi":389
* self.precomputed_index = frequent_patterns.toMap(True)
*
* x = 0 # <<<<<<<<<<<<<<
@@ -34933,20 +36869,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_int_0);
__pyx_v_x = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":390
+ /* "cdec/sa/precomputation.pxi":390
*
* x = 0
* for pattern1 in J_set: # <<<<<<<<<<<<<<
* for pattern2 in J_set:
* if len(pattern1) + len(pattern2) + 1 < self.max_length:
*/
- __pyx_t_1 = PyObject_GetIter(__pyx_v_J_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = PyObject_GetIter(__pyx_v_J_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_9 = __pyx_t_5(__pyx_t_1);
- if (unlikely(!__pyx_t_9)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -34954,25 +36890,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_9);
- __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":391
+ /* "cdec/sa/precomputation.pxi":391
* x = 0
* for pattern1 in J_set:
* for pattern2 in J_set: # <<<<<<<<<<<<<<
* if len(pattern1) + len(pattern2) + 1 < self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
*/
- __pyx_t_9 = PyObject_GetIter(__pyx_v_J_set); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_21 = Py_TYPE(__pyx_t_9)->tp_iternext;
+ __pyx_t_4 = PyObject_GetIter(__pyx_v_J_set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_19 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_3 = __pyx_t_21(__pyx_t_9);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_8 = __pyx_t_19(__pyx_t_4);
+ if (unlikely(!__pyx_t_8)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -34980,12 +36916,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":392
+ /* "cdec/sa/precomputation.pxi":392
* for pattern1 in J_set:
* for pattern2 in J_set:
* if len(pattern1) + len(pattern2) + 1 < self.max_length: # <<<<<<<<<<<<<<
@@ -34994,25 +36930,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_15 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_20 = ((((__pyx_t_2 + __pyx_t_15) + 1) < __pyx_v_self->max_length) != 0);
- if (__pyx_t_20) {
+ __pyx_t_12 = ((((__pyx_t_2 + __pyx_t_15) + 1) < __pyx_v_self->max_length) != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":393
+ /* "cdec/sa/precomputation.pxi":393
* for pattern2 in J_set:
* if len(pattern1) + len(pattern2) + 1 < self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
* J2_set.add(combined_pattern)
*
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__52); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__52); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
- __pyx_t_8 = 0;
+ __pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":394
+ /* "cdec/sa/precomputation.pxi":394
* if len(pattern1) + len(pattern2) + 1 < self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
* J2_set.add(combined_pattern) # <<<<<<<<<<<<<<
@@ -35020,28 +36956,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
* for pattern1 in I_set:
*/
__pyx_t_16 = PySet_Add(__pyx_v_J2_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L40;
+ goto __pyx_L52;
}
- __pyx_L40:;
+ __pyx_L52:;
+
+ /* "cdec/sa/precomputation.pxi":391
+ * x = 0
+ * for pattern1 in J_set:
+ * for pattern2 in J_set: # <<<<<<<<<<<<<<
+ * if len(pattern1) + len(pattern2) + 1 < self.max_length:
+ * combined_pattern = pattern1 + (-1,) + pattern2
+ */
}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/precomputation.pxi":390
+ *
+ * x = 0
+ * for pattern1 in J_set: # <<<<<<<<<<<<<<
+ * for pattern2 in J_set:
+ * if len(pattern1) + len(pattern2) + 1 < self.max_length:
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":396
+ /* "cdec/sa/precomputation.pxi":396
* J2_set.add(combined_pattern)
*
* for pattern1 in I_set: # <<<<<<<<<<<<<<
* for pattern2 in I_set:
* x = x+1
*/
- __pyx_t_1 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_9 = __pyx_t_5(__pyx_t_1);
- if (unlikely(!__pyx_t_9)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35049,25 +37001,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_9);
- __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":397
+ /* "cdec/sa/precomputation.pxi":397
*
* for pattern1 in I_set:
* for pattern2 in I_set: # <<<<<<<<<<<<<<
* x = x+1
* if len(pattern1) + len(pattern2) + 1 <= self.max_length:
*/
- __pyx_t_9 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_21 = Py_TYPE(__pyx_t_9)->tp_iternext;
+ __pyx_t_4 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_19 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_8 = __pyx_t_21(__pyx_t_9);
- if (unlikely(!__pyx_t_8)) {
+ __pyx_t_1 = __pyx_t_19(__pyx_t_4);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35075,24 +37027,24 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_1);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_8);
- __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":398
+ /* "cdec/sa/precomputation.pxi":398
* for pattern1 in I_set:
* for pattern2 in I_set:
* x = x+1 # <<<<<<<<<<<<<<
* if len(pattern1) + len(pattern2) + 1 <= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
*/
- __pyx_t_8 = PyNumber_Add(__pyx_v_x, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_8);
- __pyx_t_8 = 0;
+ __pyx_t_1 = PyNumber_Add(__pyx_v_x, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":399
+ /* "cdec/sa/precomputation.pxi":399
* for pattern2 in I_set:
* x = x+1
* if len(pattern1) + len(pattern2) + 1 <= self.max_length: # <<<<<<<<<<<<<<
@@ -35101,25 +37053,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_15 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_20 = ((((__pyx_t_15 + __pyx_t_2) + 1) <= __pyx_v_self->max_length) != 0);
- if (__pyx_t_20) {
+ __pyx_t_12 = ((((__pyx_t_15 + __pyx_t_2) + 1) <= __pyx_v_self->max_length) != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":400
+ /* "cdec/sa/precomputation.pxi":400
* x = x+1
* if len(pattern1) + len(pattern2) + 1 <= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
* IJ_set.add(combined_pattern)
*
*/
- __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__53); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__53); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":401
+ /* "cdec/sa/precomputation.pxi":401
* if len(pattern1) + len(pattern2) + 1 <= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
* IJ_set.add(combined_pattern) # <<<<<<<<<<<<<<
@@ -35127,28 +37079,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
* for pattern1 in I_set:
*/
__pyx_t_16 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L45;
+ goto __pyx_L57;
}
- __pyx_L45:;
+ __pyx_L57:;
+
+ /* "cdec/sa/precomputation.pxi":397
+ *
+ * for pattern1 in I_set:
+ * for pattern2 in I_set: # <<<<<<<<<<<<<<
+ * x = x+1
+ * if len(pattern1) + len(pattern2) + 1 <= self.max_length:
+ */
}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/precomputation.pxi":396
+ * J2_set.add(combined_pattern)
+ *
+ * for pattern1 in I_set: # <<<<<<<<<<<<<<
+ * for pattern2 in I_set:
+ * x = x+1
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":403
+ /* "cdec/sa/precomputation.pxi":403
* IJ_set.add(combined_pattern)
*
* for pattern1 in I_set: # <<<<<<<<<<<<<<
* for pattern2 in J2_set:
* x = x+2
*/
- __pyx_t_1 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = PyObject_GetIter(__pyx_v_I_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_9 = __pyx_t_5(__pyx_t_1);
- if (unlikely(!__pyx_t_9)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35156,25 +37124,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_9);
- __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern1, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":404
+ /* "cdec/sa/precomputation.pxi":404
*
* for pattern1 in I_set:
* for pattern2 in J2_set: # <<<<<<<<<<<<<<
* x = x+2
* if len(pattern1) + len(pattern2) + 1<= self.max_length:
*/
- __pyx_t_9 = PyObject_GetIter(__pyx_v_J2_set); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_21 = Py_TYPE(__pyx_t_9)->tp_iternext;
+ __pyx_t_4 = PyObject_GetIter(__pyx_v_J2_set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_19 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_3 = __pyx_t_21(__pyx_t_9);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_8 = __pyx_t_19(__pyx_t_4);
+ if (unlikely(!__pyx_t_8)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35182,24 +37150,24 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_8);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern2, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":405
+ /* "cdec/sa/precomputation.pxi":405
* for pattern1 in I_set:
* for pattern2 in J2_set:
* x = x+2 # <<<<<<<<<<<<<<
* if len(pattern1) + len(pattern2) + 1<= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":406
+ /* "cdec/sa/precomputation.pxi":406
* for pattern2 in J2_set:
* x = x+2
* if len(pattern1) + len(pattern2) + 1<= self.max_length: # <<<<<<<<<<<<<<
@@ -35208,25 +37176,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_2 = PyObject_Length(__pyx_v_pattern1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_15 = PyObject_Length(__pyx_v_pattern2); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_20 = ((((__pyx_t_2 + __pyx_t_15) + 1) <= __pyx_v_self->max_length) != 0);
- if (__pyx_t_20) {
+ __pyx_t_12 = ((((__pyx_t_2 + __pyx_t_15) + 1) <= __pyx_v_self->max_length) != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":407
+ /* "cdec/sa/precomputation.pxi":407
* x = x+2
* if len(pattern1) + len(pattern2) + 1<= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
* IJ_set.add(combined_pattern)
* combined_pattern = pattern2 + (-1,) + pattern1
*/
- __pyx_t_3 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__54); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_v_pattern2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Add(__pyx_v_pattern1, __pyx_tuple__54); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
- __pyx_t_8 = 0;
+ __pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_combined_pattern, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":408
+ /* "cdec/sa/precomputation.pxi":408
* if len(pattern1) + len(pattern2) + 1<= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2
* IJ_set.add(combined_pattern) # <<<<<<<<<<<<<<
@@ -35235,22 +37203,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_16 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":409
+ /* "cdec/sa/precomputation.pxi":409
* combined_pattern = pattern1 + (-1,) + pattern2
* IJ_set.add(combined_pattern)
* combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<<
* IJ_set.add(combined_pattern)
*
*/
- __pyx_t_8 = PyNumber_Add(__pyx_v_pattern2, __pyx_tuple__55); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_v_pattern2, __pyx_tuple__55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_v_pattern1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF_SET(__pyx_v_combined_pattern, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_combined_pattern, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":410
+ /* "cdec/sa/precomputation.pxi":410
* IJ_set.add(combined_pattern)
* combined_pattern = pattern2 + (-1,) + pattern1
* IJ_set.add(combined_pattern) # <<<<<<<<<<<<<<
@@ -35258,15 +37226,31 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
* N = len(pattern_rank)
*/
__pyx_t_16 = PySet_Add(__pyx_v_IJ_set, __pyx_v_combined_pattern); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L50;
+ goto __pyx_L62;
}
- __pyx_L50:;
+ __pyx_L62:;
+
+ /* "cdec/sa/precomputation.pxi":404
+ *
+ * for pattern1 in I_set:
+ * for pattern2 in J2_set: # <<<<<<<<<<<<<<
+ * x = x+2
+ * if len(pattern1) + len(pattern2) + 1<= self.max_length:
+ */
}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/precomputation.pxi":403
+ * IJ_set.add(combined_pattern)
+ *
+ * for pattern1 in I_set: # <<<<<<<<<<<<<<
+ * for pattern2 in J2_set:
+ * x = x+2
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":412
+ /* "cdec/sa/precomputation.pxi":412
* IJ_set.add(combined_pattern)
*
* N = len(pattern_rank) # <<<<<<<<<<<<<<
@@ -35276,45 +37260,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_15 = PyDict_Size(__pyx_v_pattern_rank); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_N = __pyx_t_15;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":413
+ /* "cdec/sa/precomputation.pxi":413
*
* N = len(pattern_rank)
* cost_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<<
* count_by_rank = IntList(initial_len=N)
* for pattern, arr in self.precomputed_collocations.iteritems():
*/
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_initial_len, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_cost_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_9);
- __pyx_t_9 = 0;
+ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_initial_len, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_cost_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":414
+ /* "cdec/sa/precomputation.pxi":414
* N = len(pattern_rank)
* cost_by_rank = IntList(initial_len=N)
* count_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<<
* for pattern, arr in self.precomputed_collocations.iteritems():
* if pattern not in IJ_set:
*/
- __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_initial_len, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_v_count_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_initial_len, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_count_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":415
+ /* "cdec/sa/precomputation.pxi":415
* cost_by_rank = IntList(initial_len=N)
* count_by_rank = IntList(initial_len=N)
* for pattern, arr in self.precomputed_collocations.iteritems(): # <<<<<<<<<<<<<<
@@ -35326,34 +37310,34 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
{__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, __pyx_n_s_iteritems, (&__pyx_t_2), (&__pyx_t_14)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_XDECREF(__pyx_t_1);
- __pyx_t_1 = __pyx_t_9;
- __pyx_t_9 = 0;
+ __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, __pyx_n_s_iteritems, (&__pyx_t_2), (&__pyx_t_14)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_3);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_t_4 = 0;
while (1) {
- __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_15, &__pyx_t_9, &__pyx_t_3, NULL, __pyx_t_14);
+ __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_2, &__pyx_t_15, &__pyx_t_4, &__pyx_t_8, NULL, __pyx_t_14);
if (unlikely(__pyx_t_17 == 0)) break;
if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_9);
- __pyx_t_9 = 0;
- __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_8);
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":416
+ /* "cdec/sa/precomputation.pxi":416
* count_by_rank = IntList(initial_len=N)
* for pattern, arr in self.precomputed_collocations.iteritems():
* if pattern not in IJ_set: # <<<<<<<<<<<<<<
* s = ""
* for word_id in pattern:
*/
- __pyx_t_20 = (__Pyx_PySequence_Contains(__pyx_v_pattern, __pyx_v_IJ_set, Py_NE)); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_12 = (__pyx_t_20 != 0);
- if (__pyx_t_12) {
+ __pyx_t_12 = (__Pyx_PySequence_Contains(__pyx_v_pattern, __pyx_v_IJ_set, Py_NE)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = (__pyx_t_12 != 0);
+ if (__pyx_t_18) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":417
+ /* "cdec/sa/precomputation.pxi":417
* for pattern, arr in self.precomputed_collocations.iteritems():
* if pattern not in IJ_set:
* s = "" # <<<<<<<<<<<<<<
@@ -35363,39 +37347,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_kp_s__32);
__Pyx_XDECREF_SET(__pyx_v_s, __pyx_kp_s__32);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":418
+ /* "cdec/sa/precomputation.pxi":418
* if pattern not in IJ_set:
* s = ""
* for word_id in pattern: # <<<<<<<<<<<<<<
* if word_id == -1:
* s = s + "X "
*/
- if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
- __pyx_t_3 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0;
- __pyx_t_5 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_pattern)) || PyTuple_CheckExact(__pyx_v_pattern)) {
+ __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
+ __pyx_t_6 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_13 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_6 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_8))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_9 = __pyx_t_5(__pyx_t_3);
- if (unlikely(!__pyx_t_9)) {
+ __pyx_t_4 = __pyx_t_6(__pyx_t_8);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35403,90 +37389,113 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_9);
- __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":419
+ /* "cdec/sa/precomputation.pxi":419
* s = ""
* for word_id in pattern:
* if word_id == -1: # <<<<<<<<<<<<<<
* s = s + "X "
* else:
*/
- __pyx_t_9 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (__pyx_t_12) {
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_18) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":420
+ /* "cdec/sa/precomputation.pxi":420
* for word_id in pattern:
* if word_id == -1:
* s = s + "X " # <<<<<<<<<<<<<<
* else:
* s = s + darray.id2word[word_id] + " "
*/
- __pyx_t_9 = PyNumber_Add(__pyx_v_s, __pyx_kp_s_X); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_9);
- __pyx_t_9 = 0;
- goto __pyx_L56;
+ __pyx_t_4 = PyNumber_Add(__pyx_v_s, __pyx_kp_s_X); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4);
+ __pyx_t_4 = 0;
+ goto __pyx_L68;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":422
+ /* "cdec/sa/precomputation.pxi":422
* s = s + "X "
* else:
* s = s + darray.id2word[word_id] + " " # <<<<<<<<<<<<<<
* logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s)
* else:
*/
- __pyx_t_9 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_8 = PyNumber_Add(__pyx_v_s, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_kp_s__46); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_9);
- __pyx_t_9 = 0;
+ __pyx_t_4 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyNumber_Add(__pyx_v_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_kp_s__46); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_4);
+ __pyx_t_4 = 0;
}
- __pyx_L56:;
+ __pyx_L68:;
+
+ /* "cdec/sa/precomputation.pxi":418
+ * if pattern not in IJ_set:
+ * s = ""
+ * for word_id in pattern: # <<<<<<<<<<<<<<
+ * if word_id == -1:
+ * s = s + "X "
+ */
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":423
+ /* "cdec/sa/precomputation.pxi":423
* else:
* s = s + darray.id2word[word_id] + " "
* logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) # <<<<<<<<<<<<<<
* else:
* chunk = ()
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ __pyx_t_13 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_13 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_ERROR_unexpected_pattern_s_in_se);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_ERROR_unexpected_pattern_s_in_se);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_13, __pyx_kp_s_ERROR_unexpected_pattern_s_in_se);
__Pyx_GIVEREF(__pyx_kp_s_ERROR_unexpected_pattern_s_in_se);
__Pyx_INCREF(__pyx_v_s);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_s);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_13, __pyx_v_s);
__Pyx_GIVEREF(__pyx_v_s);
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- goto __pyx_L53;
+ goto __pyx_L65;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":425
+ /* "cdec/sa/precomputation.pxi":425
* logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s)
* else:
* chunk = () # <<<<<<<<<<<<<<
@@ -35496,7 +37505,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_empty_tuple);
__Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_empty_tuple);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":426
+ /* "cdec/sa/precomputation.pxi":426
* else:
* chunk = ()
* max_rank = 0 # <<<<<<<<<<<<<<
@@ -35505,7 +37514,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_v_max_rank = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":427
+ /* "cdec/sa/precomputation.pxi":427
* chunk = ()
* max_rank = 0
* arity = 0 # <<<<<<<<<<<<<<
@@ -35515,39 +37524,41 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_arity, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":428
+ /* "cdec/sa/precomputation.pxi":428
* max_rank = 0
* arity = 0
* for word_id in pattern: # <<<<<<<<<<<<<<
* if word_id == -1:
* max_rank = max(max_rank, pattern_rank[chunk])
*/
- if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
+ if (likely(PyList_CheckExact(__pyx_v_pattern)) || PyTuple_CheckExact(__pyx_v_pattern)) {
__pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
- __pyx_t_5 = NULL;
+ __pyx_t_6 = NULL;
} else {
__pyx_t_13 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_5 = Py_TYPE(__pyx_t_8)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_8)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_8)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_8))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_5(__pyx_t_8);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_1 = __pyx_t_6(__pyx_t_8);
+ if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35555,54 +37566,54 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_1);
}
- __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":429
+ /* "cdec/sa/precomputation.pxi":429
* arity = 0
* for word_id in pattern:
* if word_id == -1: # <<<<<<<<<<<<<<
* max_rank = max(max_rank, pattern_rank[chunk])
* arity = arity + 1
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_12) {
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_word_id, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (__pyx_t_18) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":430
+ /* "cdec/sa/precomputation.pxi":430
* for word_id in pattern:
* if word_id == -1:
* max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<<
* arity = arity + 1
* chunk = ()
*/
- __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_pattern_rank, __pyx_v_chunk); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_pattern_rank, __pyx_v_chunk); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_17 = __pyx_v_max_rank;
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (__pyx_t_12) {
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_9 = __pyx_t_3;
+ if (__pyx_t_18) {
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_9 = __pyx_t_1;
} else {
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_9 = __pyx_t_7;
__pyx_t_7 = 0;
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_max_rank = __pyx_t_17;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":431
+ /* "cdec/sa/precomputation.pxi":431
* if word_id == -1:
* max_rank = max(max_rank, pattern_rank[chunk])
* arity = arity + 1 # <<<<<<<<<<<<<<
@@ -35614,7 +37625,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_9);
__pyx_t_9 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":432
+ /* "cdec/sa/precomputation.pxi":432
* max_rank = max(max_rank, pattern_rank[chunk])
* arity = arity + 1
* chunk = () # <<<<<<<<<<<<<<
@@ -35623,11 +37634,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__Pyx_INCREF(__pyx_empty_tuple);
__Pyx_DECREF_SET(__pyx_v_chunk, __pyx_empty_tuple);
- goto __pyx_L59;
+ goto __pyx_L71;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":434
+ /* "cdec/sa/precomputation.pxi":434
* chunk = ()
* else:
* chunk = chunk + (word_id,) # <<<<<<<<<<<<<<
@@ -35639,17 +37650,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_v_word_id);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_word_id);
__Pyx_GIVEREF(__pyx_v_word_id);
- __pyx_t_3 = PyNumber_Add(__pyx_v_chunk, __pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyNumber_Add(__pyx_v_chunk, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_3));
- __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_chunk, ((PyObject*)__pyx_t_1));
+ __pyx_t_1 = 0;
}
- __pyx_L59:;
+ __pyx_L71:;
+
+ /* "cdec/sa/precomputation.pxi":428
+ * max_rank = 0
+ * arity = 0
+ * for word_id in pattern: # <<<<<<<<<<<<<<
+ * if word_id == -1:
+ * max_rank = max(max_rank, pattern_rank[chunk])
+ */
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":435
+ /* "cdec/sa/precomputation.pxi":435
* else:
* chunk = chunk + (word_id,)
* max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<<
@@ -35663,23 +37682,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_9, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (__pyx_t_12) {
+ if (__pyx_t_18) {
__Pyx_INCREF(__pyx_t_8);
- __pyx_t_3 = __pyx_t_8;
+ __pyx_t_1 = __pyx_t_8;
} else {
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_3 = __pyx_t_7;
+ __pyx_t_1 = __pyx_t_7;
__pyx_t_7 = 0;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_max_rank = __pyx_t_17;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":436
+ /* "cdec/sa/precomputation.pxi":436
* chunk = chunk + (word_id,)
* max_rank = max(max_rank, pattern_rank[chunk])
* cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr)) # <<<<<<<<<<<<<<
@@ -35689,15 +37708,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_13 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) = ((__pyx_v_cost_by_rank->arr[__pyx_v_max_rank]) + (4 * __pyx_t_13));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":437
+ /* "cdec/sa/precomputation.pxi":437
* max_rank = max(max_rank, pattern_rank[chunk])
* cost_by_rank.arr[max_rank] = cost_by_rank.arr[max_rank] + (4*len(arr))
* count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) # <<<<<<<<<<<<<<
*
* cumul_cost = 0
*/
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__pyx_t_13 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
@@ -35707,19 +37726,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
(__pyx_v_count_by_rank->arr[__pyx_v_max_rank]) = __pyx_t_17;
}
- __pyx_L53:;
+ __pyx_L65:;
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":439
+ /* "cdec/sa/precomputation.pxi":439
* count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1))
*
* cumul_cost = 0 # <<<<<<<<<<<<<<
@@ -35729,7 +37748,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_int_0);
__pyx_v_cumul_cost = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":440
+ /* "cdec/sa/precomputation.pxi":440
*
* cumul_cost = 0
* cumul_count = 0 # <<<<<<<<<<<<<<
@@ -35739,7 +37758,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_INCREF(__pyx_int_0);
__pyx_v_cumul_count = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":441
+ /* "cdec/sa/precomputation.pxi":441
* cumul_cost = 0
* cumul_count = 0
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
@@ -35749,22 +37768,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_t_14 = __pyx_v_N;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":442
+ /* "cdec/sa/precomputation.pxi":442
* cumul_count = 0
* for i from 0 <= i < N:
* cumul_cost = cumul_cost + cost_by_rank.arr[i] # <<<<<<<<<<<<<<
* cumul_count = cumul_count + count_by_rank.arr[i]
* logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost)
*/
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyNumber_Add(__pyx_v_cumul_cost, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = PyNumber_Add(__pyx_v_cumul_cost, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_cumul_cost, __pyx_t_7);
__pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":443
+ /* "cdec/sa/precomputation.pxi":443
* for i from 0 <= i < N:
* cumul_cost = cumul_cost + cost_by_rank.arr[i]
* cumul_count = cumul_count + count_by_rank.arr[i] # <<<<<<<<<<<<<<
@@ -35773,58 +37792,73 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_1 = PyNumber_Add(__pyx_v_cumul_count, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyNumber_Add(__pyx_v_cumul_count, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF_SET(__pyx_v_cumul_count, __pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_cumul_count, __pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":444
+ /* "cdec/sa/precomputation.pxi":444
* cumul_cost = cumul_cost + cost_by_rank.arr[i]
* cumul_count = cumul_count + count_by_rank.arr[i]
* logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost) # <<<<<<<<<<<<<<
*
* num_found_patterns = len(self.precomputed_collocations)
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_count_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyInt_From_int((__pyx_v_cost_by_rank->arr[__pyx_v_i])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_10 = PyTuple_New(6+__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_RANK_d_COUNT_COST_d_d_CUMUL_d_d);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s_RANK_d_COUNT_COST_d_d_CUMUL_d_d);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_2, __pyx_kp_s_RANK_d_COUNT_COST_d_d_CUMUL_d_d);
__Pyx_GIVEREF(__pyx_kp_s_RANK_d_COUNT_COST_d_d_CUMUL_d_d);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_2, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_2, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
- __Pyx_GIVEREF(__pyx_t_9);
- PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_2, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_cumul_count);
- PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_cumul_count);
+ PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_2, __pyx_v_cumul_count);
__Pyx_GIVEREF(__pyx_v_cumul_count);
__Pyx_INCREF(__pyx_v_cumul_cost);
- PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_cumul_cost);
+ PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_2, __pyx_v_cumul_cost);
__Pyx_GIVEREF(__pyx_v_cumul_cost);
+ __pyx_t_7 = 0;
__pyx_t_1 = 0;
- __pyx_t_9 = 0;
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":446
+ /* "cdec/sa/precomputation.pxi":446
* logger.debug("RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d", i, count_by_rank.arr[i], cost_by_rank.arr[i], cumul_count, cumul_cost)
*
* num_found_patterns = len(self.precomputed_collocations) # <<<<<<<<<<<<<<
@@ -35837,7 +37871,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_num_found_patterns = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":447
+ /* "cdec/sa/precomputation.pxi":447
*
* num_found_patterns = len(self.precomputed_collocations)
* for pattern in IJ_set: # <<<<<<<<<<<<<<
@@ -35846,11 +37880,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
*/
__pyx_t_3 = PyObject_GetIter(__pyx_v_IJ_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_8 = __pyx_t_5(__pyx_t_3);
- if (unlikely(!__pyx_t_8)) {
+ __pyx_t_9 = __pyx_t_6(__pyx_t_3);
+ if (unlikely(!__pyx_t_9)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -35858,153 +37892,221 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
}
break;
}
- __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_GOTREF(__pyx_t_9);
}
- __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_8);
- __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_9);
+ __pyx_t_9 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":448
+ /* "cdec/sa/precomputation.pxi":448
* num_found_patterns = len(self.precomputed_collocations)
* for pattern in IJ_set:
* if pattern not in self.precomputed_collocations: # <<<<<<<<<<<<<<
* self.precomputed_collocations[pattern] = IntList()
*
*/
- __pyx_t_12 = (__Pyx_PySequence_Contains(__pyx_v_pattern, __pyx_v_self->precomputed_collocations, Py_NE)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_20 = (__pyx_t_12 != 0);
- if (__pyx_t_20) {
+ __pyx_t_18 = (__Pyx_PySequence_Contains(__pyx_v_pattern, __pyx_v_self->precomputed_collocations, Py_NE)); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = (__pyx_t_18 != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":449
+ /* "cdec/sa/precomputation.pxi":449
* for pattern in IJ_set:
* if pattern not in self.precomputed_collocations:
* self.precomputed_collocations[pattern] = IntList() # <<<<<<<<<<<<<<
*
* cdef float stop_time = monitor_cpu()
*/
- __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- if (unlikely(PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_pattern, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- goto __pyx_L64;
+ __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (unlikely(PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_pattern, __pyx_t_9) < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ goto __pyx_L76;
}
- __pyx_L64:;
+ __pyx_L76:;
+
+ /* "cdec/sa/precomputation.pxi":447
+ *
+ * num_found_patterns = len(self.precomputed_collocations)
+ * for pattern in IJ_set: # <<<<<<<<<<<<<<
+ * if pattern not in self.precomputed_collocations:
+ * self.precomputed_collocations[pattern] = IntList()
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":451
+ /* "cdec/sa/precomputation.pxi":451
* self.precomputed_collocations[pattern] = IntList()
*
* cdef float stop_time = monitor_cpu() # <<<<<<<<<<<<<<
* logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x)
* logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index))
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_8); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_v_stop_time = __pyx_t_4;
+ __pyx_v_stop_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":452
+ /* "cdec/sa/precomputation.pxi":452
*
* cdef float stop_time = monitor_cpu()
* logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x) # <<<<<<<<<<<<<<
* logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index))
* logger.info("Precomputation took %f seconds", (stop_time - start_time))
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_info); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_num_found_patterns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_8 = __pyx_v_self->precomputed_collocations;
+ __Pyx_INCREF(__pyx_t_8);
+ __pyx_t_2 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_num_found_patterns); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_7 = __pyx_v_self->precomputed_collocations;
- __Pyx_INCREF(__pyx_t_7);
- __pyx_t_2 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(4+__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_1) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Precomputed_collocations_for_d_p);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_s_Precomputed_collocations_for_d_p);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_kp_s_Precomputed_collocations_for_d_p);
__Pyx_GIVEREF(__pyx_kp_s_Precomputed_collocations_for_d_p);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_2, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_x);
- PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_2, __pyx_v_x);
__Pyx_GIVEREF(__pyx_v_x);
+ __pyx_t_9 = 0;
__pyx_t_8 = 0;
- __pyx_t_7 = 0;
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":453
+ /* "cdec/sa/precomputation.pxi":453
* cdef float stop_time = monitor_cpu()
* logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x)
* logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index)) # <<<<<<<<<<<<<<
* logger.info("Precomputation took %f seconds", (stop_time - start_time))
*/
- __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = __pyx_v_self->precomputed_index;
+ __Pyx_INCREF(__pyx_t_10);
+ __pyx_t_2 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = __pyx_v_self->precomputed_index;
- __Pyx_INCREF(__pyx_t_7);
- __pyx_t_2 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Precomputed_inverted_index_for_d);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_Precomputed_inverted_index_for_d);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_2, __pyx_kp_s_Precomputed_inverted_index_for_d);
__Pyx_GIVEREF(__pyx_kp_s_Precomputed_inverted_index_for_d);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_t_7 = 0;
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_2, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":454
+ /* "cdec/sa/precomputation.pxi":454
* logger.info("Precomputed collocations for %d patterns out of %d possible (upper bound %d)", num_found_patterns, len(self.precomputed_collocations), x)
* logger.info("Precomputed inverted index for %d patterns ", len(self.precomputed_index))
* logger.info("Precomputation took %f seconds", (stop_time - start_time)) # <<<<<<<<<<<<<<
*/
__pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_10 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_10) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Precomputation_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_s_Precomputation_took_f_seconds);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_2, __pyx_kp_s_Precomputation_took_f_seconds);
__Pyx_GIVEREF(__pyx_kp_s_Precomputation_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_2, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_7 = 0;
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":278
+ /* "cdec/sa/precomputation.pxi":278
*
*
* def precompute(self, stats, SuffixArray sarray): # <<<<<<<<<<<<<<
@@ -36018,7 +38120,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
@@ -36059,7 +38161,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __p
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":11
+/* "cdec/sa/suffix_array.pxi":11
* cdef IntList ha
*
* def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<<
@@ -36151,12 +38253,14 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":12
+ /* "cdec/sa/suffix_array.pxi":12
*
* def __cinit__(self, from_binary=None, from_text=None, side=None):
* self.darray = DataArray() # <<<<<<<<<<<<<<
@@ -36171,7 +38275,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":13
+ /* "cdec/sa/suffix_array.pxi":13
* def __cinit__(self, from_binary=None, from_text=None, side=None):
* self.darray = DataArray()
* self.sa = IntList() # <<<<<<<<<<<<<<
@@ -36186,7 +38290,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":14
+ /* "cdec/sa/suffix_array.pxi":14
* self.darray = DataArray()
* self.sa = IntList()
* self.ha = IntList() # <<<<<<<<<<<<<<
@@ -36201,7 +38305,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":15
+ /* "cdec/sa/suffix_array.pxi":15
* self.sa = IntList()
* self.ha = IntList()
* if from_binary: # <<<<<<<<<<<<<<
@@ -36211,29 +38315,45 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_binary); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":16
+ /* "cdec/sa/suffix_array.pxi":16
* self.ha = IntList()
* if from_binary:
* self.read_binary(from_binary) # <<<<<<<<<<<<<<
* elif from_text:
* self.read_text(from_text, side)
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_binary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_from_binary);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_binary);
- __Pyx_GIVEREF(__pyx_v_from_binary);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_from_binary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(__pyx_v_from_binary);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_from_binary);
+ __Pyx_GIVEREF(__pyx_v_from_binary);
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":17
+ /* "cdec/sa/suffix_array.pxi":17
* if from_binary:
* self.read_binary(from_binary)
* elif from_text: # <<<<<<<<<<<<<<
@@ -36243,24 +38363,39 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_from_text); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":18
+ /* "cdec/sa/suffix_array.pxi":18
* self.read_binary(from_binary)
* elif from_text:
* self.read_text(from_text, side) # <<<<<<<<<<<<<<
*
* def __getitem__(self, i):
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read_text); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_v_from_text);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_from_text);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_from_text);
__Pyx_GIVEREF(__pyx_v_from_text);
__Pyx_INCREF(__pyx_v_side);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_side);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_side);
__Pyx_GIVEREF(__pyx_v_side);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -36269,7 +38404,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":11
+ /* "cdec/sa/suffix_array.pxi":11
* cdef IntList ha
*
* def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<<
@@ -36284,6 +38419,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -36291,7 +38427,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":20
+/* "cdec/sa/suffix_array.pxi":20
* self.read_text(from_text, side)
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -36322,7 +38458,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":21
+ /* "cdec/sa/suffix_array.pxi":21
*
* def __getitem__(self, i):
* return self.sa.arr[i] # <<<<<<<<<<<<<<
@@ -36337,7 +38473,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":20
+ /* "cdec/sa/suffix_array.pxi":20
* self.read_text(from_text, side)
*
* def __getitem__(self, i): # <<<<<<<<<<<<<<
@@ -36356,7 +38492,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":23
+/* "cdec/sa/suffix_array.pxi":23
* return self.sa.arr[i]
*
* def read_text(self, filename, side): # <<<<<<<<<<<<<<
@@ -36445,21 +38581,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
- float __pyx_t_4;
- int __pyx_t_5;
- long __pyx_t_6;
- int __pyx_t_7;
+ PyObject *__pyx_t_4 = NULL;
+ float __pyx_t_5;
+ int __pyx_t_6;
+ long __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("read_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":29
+ /* "cdec/sa/suffix_array.pxi":29
* cdef IntList isa, word_count
*
* self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) # <<<<<<<<<<<<<<
@@ -36480,7 +38617,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":30
+ /* "cdec/sa/suffix_array.pxi":30
*
* self.darray = DataArray(from_text=filename, side=side, use_sent_id=True)
* N = len(self.darray) # <<<<<<<<<<<<<<
@@ -36493,7 +38630,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_N = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":31
+ /* "cdec/sa/suffix_array.pxi":31
* self.darray = DataArray(from_text=filename, side=side, use_sent_id=True)
* N = len(self.darray)
* V = len(self.darray.id2word) # <<<<<<<<<<<<<<
@@ -36506,7 +38643,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_V = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":33
+ /* "cdec/sa/suffix_array.pxi":33
* V = len(self.darray.id2word)
*
* self.sa = IntList(initial_len=N) # <<<<<<<<<<<<<<
@@ -36528,7 +38665,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":34
+ /* "cdec/sa/suffix_array.pxi":34
*
* self.sa = IntList(initial_len=N)
* self.ha = IntList(initial_len=V+1) # <<<<<<<<<<<<<<
@@ -36550,7 +38687,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":36
+ /* "cdec/sa/suffix_array.pxi":36
* self.ha = IntList(initial_len=V+1)
*
* isa = IntList(initial_len=N) # <<<<<<<<<<<<<<
@@ -36569,7 +38706,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":37
+ /* "cdec/sa/suffix_array.pxi":37
*
* isa = IntList(initial_len=N)
* word_count = IntList(initial_len=V+1) # <<<<<<<<<<<<<<
@@ -36588,23 +38725,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_v_word_count = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":40
+ /* "cdec/sa/suffix_array.pxi":40
*
* '''Step 1: bucket sort data'''
* cdef float sort_start_time = monitor_cpu() # <<<<<<<<<<<<<<
* cdef float start_time = sort_start_time
* for i from 0 <= i < N:
*/
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_sort_start_time = __pyx_t_4;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_sort_start_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":41
+ /* "cdec/sa/suffix_array.pxi":41
* '''Step 1: bucket sort data'''
* cdef float sort_start_time = monitor_cpu()
* cdef float start_time = sort_start_time # <<<<<<<<<<<<<<
@@ -36613,17 +38765,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_start_time = __pyx_v_sort_start_time;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":42
+ /* "cdec/sa/suffix_array.pxi":42
* cdef float sort_start_time = monitor_cpu()
* cdef float start_time = sort_start_time
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
* a_i = self.darray.data.arr[i]
* word_count.arr[a_i] = word_count.arr[a_i] + 1
*/
- __pyx_t_5 = __pyx_v_N;
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
+ __pyx_t_6 = __pyx_v_N;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":43
+ /* "cdec/sa/suffix_array.pxi":43
* cdef float start_time = sort_start_time
* for i from 0 <= i < N:
* a_i = self.darray.data.arr[i] # <<<<<<<<<<<<<<
@@ -36632,7 +38784,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":44
+ /* "cdec/sa/suffix_array.pxi":44
* for i from 0 <= i < N:
* a_i = self.darray.data.arr[i]
* word_count.arr[a_i] = word_count.arr[a_i] + 1 # <<<<<<<<<<<<<<
@@ -36642,7 +38794,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
(__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":46
+ /* "cdec/sa/suffix_array.pxi":46
* word_count.arr[a_i] = word_count.arr[a_i] + 1
*
* n = 0 # <<<<<<<<<<<<<<
@@ -36651,17 +38803,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_n = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":47
+ /* "cdec/sa/suffix_array.pxi":47
*
* n = 0
* for i from 0 <= i < V+1: # <<<<<<<<<<<<<<
* self.ha.arr[i] = n
* n = n + word_count.arr[i]
*/
- __pyx_t_6 = (__pyx_v_V + 1);
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
+ __pyx_t_7 = (__pyx_v_V + 1);
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":48
+ /* "cdec/sa/suffix_array.pxi":48
* n = 0
* for i from 0 <= i < V+1:
* self.ha.arr[i] = n # <<<<<<<<<<<<<<
@@ -36670,7 +38822,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
(__pyx_v_self->ha->arr[__pyx_v_i]) = __pyx_v_n;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":49
+ /* "cdec/sa/suffix_array.pxi":49
* for i from 0 <= i < V+1:
* self.ha.arr[i] = n
* n = n + word_count.arr[i] # <<<<<<<<<<<<<<
@@ -36679,7 +38831,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_n = (__pyx_v_n + (__pyx_v_word_count->arr[__pyx_v_i]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":50
+ /* "cdec/sa/suffix_array.pxi":50
* self.ha.arr[i] = n
* n = n + word_count.arr[i]
* word_count.arr[i] = 0 # <<<<<<<<<<<<<<
@@ -36689,17 +38841,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
(__pyx_v_word_count->arr[__pyx_v_i]) = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":52
+ /* "cdec/sa/suffix_array.pxi":52
* word_count.arr[i] = 0
*
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
* a_i = self.darray.data.arr[i]
* self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i
*/
- __pyx_t_5 = __pyx_v_N;
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
+ __pyx_t_6 = __pyx_v_N;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":53
+ /* "cdec/sa/suffix_array.pxi":53
*
* for i from 0 <= i < N:
* a_i = self.darray.data.arr[i] # <<<<<<<<<<<<<<
@@ -36708,7 +38860,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":54
+ /* "cdec/sa/suffix_array.pxi":54
* for i from 0 <= i < N:
* a_i = self.darray.data.arr[i]
* self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i # <<<<<<<<<<<<<<
@@ -36717,7 +38869,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
(__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_a_i]) + (__pyx_v_word_count->arr[__pyx_v_a_i]))]) = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":55
+ /* "cdec/sa/suffix_array.pxi":55
* a_i = self.darray.data.arr[i]
* self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i
* isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket # <<<<<<<<<<<<<<
@@ -36726,7 +38878,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
(__pyx_v_isa->arr[__pyx_v_i]) = ((__pyx_v_self->ha->arr[(__pyx_v_a_i + 1)]) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":56
+ /* "cdec/sa/suffix_array.pxi":56
* self.sa.arr[self.ha.arr[a_i] + word_count.arr[a_i]] = i
* isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket
* word_count.arr[a_i] = word_count.arr[a_i] + 1 # <<<<<<<<<<<<<<
@@ -36736,7 +38888,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
(__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":59
+ /* "cdec/sa/suffix_array.pxi":59
*
* '''Determine size of initial runs'''
* current_run = 0 # <<<<<<<<<<<<<<
@@ -36745,33 +38897,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_current_run = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":60
+ /* "cdec/sa/suffix_array.pxi":60
* '''Determine size of initial runs'''
* current_run = 0
* for i from 0 <= i < V+1: # <<<<<<<<<<<<<<
* if i < V and self.ha.arr[i+1] - self.ha.arr[i] == 1:
* current_run = current_run + 1
*/
- __pyx_t_6 = (__pyx_v_V + 1);
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
+ __pyx_t_7 = (__pyx_v_V + 1);
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":61
+ /* "cdec/sa/suffix_array.pxi":61
* current_run = 0
* for i from 0 <= i < V+1:
* if i < V and self.ha.arr[i+1] - self.ha.arr[i] == 1: # <<<<<<<<<<<<<<
* current_run = current_run + 1
* else:
*/
- __pyx_t_7 = ((__pyx_v_i < __pyx_v_V) != 0);
- if (__pyx_t_7) {
- __pyx_t_8 = ((((__pyx_v_self->ha->arr[(__pyx_v_i + 1)]) - (__pyx_v_self->ha->arr[__pyx_v_i])) == 1) != 0);
- __pyx_t_9 = __pyx_t_8;
+ __pyx_t_9 = ((__pyx_v_i < __pyx_v_V) != 0);
+ if (__pyx_t_9) {
+ goto __pyx_L13_next_and;
} else {
- __pyx_t_9 = __pyx_t_7;
+ __pyx_t_8 = __pyx_t_9;
+ goto __pyx_L12_bool_binop_done;
}
- if (__pyx_t_9) {
+ __pyx_L13_next_and:;
+ __pyx_t_9 = ((((__pyx_v_self->ha->arr[(__pyx_v_i + 1)]) - (__pyx_v_self->ha->arr[__pyx_v_i])) == 1) != 0);
+ __pyx_t_8 = __pyx_t_9;
+ __pyx_L12_bool_binop_done:;
+ if (__pyx_t_8) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":62
+ /* "cdec/sa/suffix_array.pxi":62
* for i from 0 <= i < V+1:
* if i < V and self.ha.arr[i+1] - self.ha.arr[i] == 1:
* current_run = current_run + 1 # <<<<<<<<<<<<<<
@@ -36783,17 +38939,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":64
+ /* "cdec/sa/suffix_array.pxi":64
* current_run = current_run + 1
* else:
* if current_run > 0: # <<<<<<<<<<<<<<
* self.sa.arr[self.ha.arr[i] - current_run] = -current_run
* current_run = 0
*/
- __pyx_t_9 = ((__pyx_v_current_run > 0) != 0);
- if (__pyx_t_9) {
+ __pyx_t_8 = ((__pyx_v_current_run > 0) != 0);
+ if (__pyx_t_8) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":65
+ /* "cdec/sa/suffix_array.pxi":65
* else:
* if current_run > 0:
* self.sa.arr[self.ha.arr[i] - current_run] = -current_run # <<<<<<<<<<<<<<
@@ -36802,7 +38958,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
(__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":66
+ /* "cdec/sa/suffix_array.pxi":66
* if current_run > 0:
* self.sa.arr[self.ha.arr[i] - current_run] = -current_run
* current_run = 0 # <<<<<<<<<<<<<<
@@ -36810,14 +38966,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time))
*/
__pyx_v_current_run = 0;
- goto __pyx_L12;
+ goto __pyx_L14;
}
- __pyx_L12:;
+ __pyx_L14:;
}
__pyx_L11:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":68
+ /* "cdec/sa/suffix_array.pxi":68
* current_run = 0
*
* logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<<
@@ -36826,35 +38982,65 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sort_start_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_10, function);
+ }
+ }
+ if (__pyx_t_11) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PyNumber_Subtract(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = PyFloat_FromDouble(__pyx_v_sort_start_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_10 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_1 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_10) {
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Bucket_sort_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_Bucket_sort_took_f_seconds);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_3, __pyx_kp_s_Bucket_sort_took_f_seconds);
__Pyx_GIVEREF(__pyx_kp_s_Bucket_sort_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_3, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":71
+ /* "cdec/sa/suffix_array.pxi":71
*
* '''Step 2: prefix-doubling sort'''
* h = 1 # <<<<<<<<<<<<<<
@@ -36863,7 +39049,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_h = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":72
+ /* "cdec/sa/suffix_array.pxi":72
* '''Step 2: prefix-doubling sort'''
* h = 1
* while self.sa.arr[0] != -N: # <<<<<<<<<<<<<<
@@ -36871,54 +39057,84 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* logger.debug(" Refining, sort depth = %d", h)
*/
while (1) {
- __pyx_t_9 = (((__pyx_v_self->sa->arr[0]) != (-__pyx_v_N)) != 0);
- if (!__pyx_t_9) break;
+ __pyx_t_8 = (((__pyx_v_self->sa->arr[0]) != (-__pyx_v_N)) != 0);
+ if (!__pyx_t_8) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":73
+ /* "cdec/sa/suffix_array.pxi":73
* h = 1
* while self.sa.arr[0] != -N:
* sort_start_time = monitor_cpu() # <<<<<<<<<<<<<<
* logger.debug(" Refining, sort depth = %d", h)
* i = 0
*/
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_sort_start_time = __pyx_t_4;
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_1) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_sort_start_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":74
+ /* "cdec/sa/suffix_array.pxi":74
* while self.sa.arr[0] != -N:
* sort_start_time = monitor_cpu()
* logger.debug(" Refining, sort depth = %d", h) # <<<<<<<<<<<<<<
* i = 0
* skip = 0
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_10 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ if (__pyx_t_11) {
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Refining_sort_depth_d);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Refining_sort_depth_d);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_3, __pyx_kp_s_Refining_sort_depth_d);
__Pyx_GIVEREF(__pyx_kp_s_Refining_sort_depth_d);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_3, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":75
+ /* "cdec/sa/suffix_array.pxi":75
* sort_start_time = monitor_cpu()
* logger.debug(" Refining, sort depth = %d", h)
* i = 0 # <<<<<<<<<<<<<<
@@ -36927,7 +39143,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_i = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":76
+ /* "cdec/sa/suffix_array.pxi":76
* logger.debug(" Refining, sort depth = %d", h)
* i = 0
* skip = 0 # <<<<<<<<<<<<<<
@@ -36936,7 +39152,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_skip = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":77
+ /* "cdec/sa/suffix_array.pxi":77
* i = 0
* skip = 0
* while i < N: # <<<<<<<<<<<<<<
@@ -36944,20 +39160,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* skip = skip + self.sa.arr[i]
*/
while (1) {
- __pyx_t_9 = ((__pyx_v_i < __pyx_v_N) != 0);
- if (!__pyx_t_9) break;
+ __pyx_t_8 = ((__pyx_v_i < __pyx_v_N) != 0);
+ if (!__pyx_t_8) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":78
+ /* "cdec/sa/suffix_array.pxi":78
* skip = 0
* while i < N:
* if self.sa.arr[i] < 0: # <<<<<<<<<<<<<<
* skip = skip + self.sa.arr[i]
* i = i - self.sa.arr[i]
*/
- __pyx_t_9 = (((__pyx_v_self->sa->arr[__pyx_v_i]) < 0) != 0);
- if (__pyx_t_9) {
+ __pyx_t_8 = (((__pyx_v_self->sa->arr[__pyx_v_i]) < 0) != 0);
+ if (__pyx_t_8) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":79
+ /* "cdec/sa/suffix_array.pxi":79
* while i < N:
* if self.sa.arr[i] < 0:
* skip = skip + self.sa.arr[i] # <<<<<<<<<<<<<<
@@ -36966,7 +39182,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_skip = (__pyx_v_skip + (__pyx_v_self->sa->arr[__pyx_v_i]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":80
+ /* "cdec/sa/suffix_array.pxi":80
* if self.sa.arr[i] < 0:
* skip = skip + self.sa.arr[i]
* i = i - self.sa.arr[i] # <<<<<<<<<<<<<<
@@ -36974,21 +39190,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* if skip < 0:
*/
__pyx_v_i = (__pyx_v_i - (__pyx_v_self->sa->arr[__pyx_v_i]));
- goto __pyx_L17;
+ goto __pyx_L19;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":82
+ /* "cdec/sa/suffix_array.pxi":82
* i = i - self.sa.arr[i]
* else:
* if skip < 0: # <<<<<<<<<<<<<<
* self.sa.arr[i+skip] = skip
* skip = 0
*/
- __pyx_t_9 = ((__pyx_v_skip < 0) != 0);
- if (__pyx_t_9) {
+ __pyx_t_8 = ((__pyx_v_skip < 0) != 0);
+ if (__pyx_t_8) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":83
+ /* "cdec/sa/suffix_array.pxi":83
* else:
* if skip < 0:
* self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<<
@@ -36997,7 +39213,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
(__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":84
+ /* "cdec/sa/suffix_array.pxi":84
* if skip < 0:
* self.sa.arr[i+skip] = skip
* skip = 0 # <<<<<<<<<<<<<<
@@ -37005,11 +39221,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* self.q3sort(i, j, h, isa)
*/
__pyx_v_skip = 0;
- goto __pyx_L18;
+ goto __pyx_L20;
}
- __pyx_L18:;
+ __pyx_L20:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":85
+ /* "cdec/sa/suffix_array.pxi":85
* self.sa.arr[i+skip] = skip
* skip = 0
* j = isa.arr[self.sa.arr[i]] # <<<<<<<<<<<<<<
@@ -37018,7 +39234,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_j = (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":86
+ /* "cdec/sa/suffix_array.pxi":86
* skip = 0
* j = isa.arr[self.sa.arr[i]]
* self.q3sort(i, j, h, isa) # <<<<<<<<<<<<<<
@@ -37027,33 +39243,48 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_q3sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_12);
- PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_10);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_12 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_13 = PyTuple_New(4+__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ if (__pyx_t_12) {
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_3, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_3, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_3, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
__Pyx_INCREF(((PyObject *)__pyx_v_isa));
- PyTuple_SET_ITEM(__pyx_t_12, 3, ((PyObject *)__pyx_v_isa));
+ PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_3, ((PyObject *)__pyx_v_isa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_isa));
- __pyx_t_2 = 0;
- __pyx_t_11 = 0;
__pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_4 = 0;
+ __pyx_t_11 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":87
+ /* "cdec/sa/suffix_array.pxi":87
* j = isa.arr[self.sa.arr[i]]
* self.q3sort(i, j, h, isa)
* i = j+1 # <<<<<<<<<<<<<<
@@ -37062,20 +39293,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_i = (__pyx_v_j + 1);
}
- __pyx_L17:;
+ __pyx_L19:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":88
+ /* "cdec/sa/suffix_array.pxi":88
* self.q3sort(i, j, h, isa)
* i = j+1
* if skip < 0: # <<<<<<<<<<<<<<
* self.sa.arr[i+skip] = skip
* h = h * 2
*/
- __pyx_t_9 = ((__pyx_v_skip < 0) != 0);
- if (__pyx_t_9) {
+ __pyx_t_8 = ((__pyx_v_skip < 0) != 0);
+ if (__pyx_t_8) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":89
+ /* "cdec/sa/suffix_array.pxi":89
* i = j+1
* if skip < 0:
* self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<<
@@ -37083,11 +39314,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
* logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time))
*/
(__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip;
- goto __pyx_L19;
+ goto __pyx_L21;
}
- __pyx_L19:;
+ __pyx_L21:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":90
+ /* "cdec/sa/suffix_array.pxi":90
* if skip < 0:
* self.sa.arr[i+skip] = skip
* h = h * 2 # <<<<<<<<<<<<<<
@@ -37096,72 +39327,102 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_h = (__pyx_v_h * 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":91
+ /* "cdec/sa/suffix_array.pxi":91
* self.sa.arr[i+skip] = skip
* h = h * 2
* logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<<
*
* '''Step 3: read off suffix array from inverse suffix array'''
*/
- __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_debug); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyFloat_FromDouble(__pyx_v_sort_start_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = PyNumber_Subtract(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_11, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = PyFloat_FromDouble(__pyx_v_sort_start_time); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_11 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_13, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_1 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_11) {
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Refinement_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_s_Refinement_took_f_seconds);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_3, __pyx_kp_s_Refinement_took_f_seconds);
__Pyx_GIVEREF(__pyx_kp_s_Refinement_took_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_3, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":94
+ /* "cdec/sa/suffix_array.pxi":94
*
* '''Step 3: read off suffix array from inverse suffix array'''
* logger.info(" Finalizing sort...") # <<<<<<<<<<<<<<
* for i from 0 <= i < N:
* j = isa.arr[i]
*/
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_info); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":95
+ /* "cdec/sa/suffix_array.pxi":95
* '''Step 3: read off suffix array from inverse suffix array'''
* logger.info(" Finalizing sort...")
* for i from 0 <= i < N: # <<<<<<<<<<<<<<
* j = isa.arr[i]
* self.sa.arr[j] = i
*/
- __pyx_t_5 = __pyx_v_N;
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
+ __pyx_t_6 = __pyx_v_N;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":96
+ /* "cdec/sa/suffix_array.pxi":96
* logger.info(" Finalizing sort...")
* for i from 0 <= i < N:
* j = isa.arr[i] # <<<<<<<<<<<<<<
@@ -37170,7 +39431,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
*/
__pyx_v_j = (__pyx_v_isa->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":97
+ /* "cdec/sa/suffix_array.pxi":97
* for i from 0 <= i < N:
* j = isa.arr[i]
* self.sa.arr[j] = i # <<<<<<<<<<<<<<
@@ -37180,44 +39441,74 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
(__pyx_v_self->sa->arr[__pyx_v_j]) = __pyx_v_i;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":98
+ /* "cdec/sa/suffix_array.pxi":98
* j = isa.arr[i]
* self.sa.arr[j] = i
* logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) # <<<<<<<<<<<<<<
*
* def q3sort(self, int i, int j, int h, IntList isa, pad=""):
*/
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_info); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_12);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyFloat_FromDouble(__pyx_v_start_time); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_11) {
+ __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_11); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ } else {
+ __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_start_time); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = PyNumber_Subtract(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_13 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Suffix_array_construction_took_f);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_Suffix_array_construction_took_f);
+ PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_3, __pyx_kp_s_Suffix_array_construction_took_f);
__Pyx_GIVEREF(__pyx_kp_s_Suffix_array_construction_took_f);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_3, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_11 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":23
+ /* "cdec/sa/suffix_array.pxi":23
* return self.sa.arr[i]
*
* def read_text(self, filename, side): # <<<<<<<<<<<<<<
@@ -37231,9 +39522,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
+ __Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -37244,7 +39537,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":100
+/* "cdec/sa/suffix_array.pxi":100
* logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time))
*
* def q3sort(self, int i, int j, int h, IntList isa, pad=""): # <<<<<<<<<<<<<<
@@ -37366,12 +39659,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ Py_ssize_t __pyx_t_10;
+ PyObject *__pyx_t_11 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("q3sort", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":107
+ /* "cdec/sa/suffix_array.pxi":107
* cdef int k, midpoint, pval, phead, ptail, tmp
*
* if j-i < -1: # <<<<<<<<<<<<<<
@@ -37381,7 +39677,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = (((__pyx_v_j - __pyx_v_i) < -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":108
+ /* "cdec/sa/suffix_array.pxi":108
*
* if j-i < -1:
* raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j)) # <<<<<<<<<<<<<<
@@ -37416,7 +39712,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
{__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":109
+ /* "cdec/sa/suffix_array.pxi":109
* if j-i < -1:
* raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j))
* if j-i == -1: # recursive base case -- empty interval # <<<<<<<<<<<<<<
@@ -37426,7 +39722,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":110
+ /* "cdec/sa/suffix_array.pxi":110
* raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j))
* if j-i == -1: # recursive base case -- empty interval
* return # <<<<<<<<<<<<<<
@@ -37438,7 +39734,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":111
+ /* "cdec/sa/suffix_array.pxi":111
* if j-i == -1: # recursive base case -- empty interval
* return
* if (j-i == 0): # recursive base case -- singleton interval # <<<<<<<<<<<<<<
@@ -37448,7 +39744,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":112
+ /* "cdec/sa/suffix_array.pxi":112
* return
* if (j-i == 0): # recursive base case -- singleton interval
* isa.arr[self.sa.arr[i]] = i # <<<<<<<<<<<<<<
@@ -37457,7 +39753,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]) = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":113
+ /* "cdec/sa/suffix_array.pxi":113
* if (j-i == 0): # recursive base case -- singleton interval
* isa.arr[self.sa.arr[i]] = i
* self.sa.arr[i] = -1 # <<<<<<<<<<<<<<
@@ -37466,7 +39762,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[__pyx_v_i]) = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":114
+ /* "cdec/sa/suffix_array.pxi":114
* isa.arr[self.sa.arr[i]] = i
* self.sa.arr[i] = -1
* return # <<<<<<<<<<<<<<
@@ -37478,7 +39774,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":123
+ /* "cdec/sa/suffix_array.pxi":123
* # If the method of assigning word_id's is changed, this method
* # may need to be reconsidered as well.
* midpoint = (i+j)/2 # <<<<<<<<<<<<<<
@@ -37487,7 +39783,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_midpoint = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":124
+ /* "cdec/sa/suffix_array.pxi":124
* # may need to be reconsidered as well.
* midpoint = (i+j)/2
* pval = isa.arr[self.sa.arr[midpoint] + h] # <<<<<<<<<<<<<<
@@ -37496,7 +39792,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_pval = (__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":125
+ /* "cdec/sa/suffix_array.pxi":125
* midpoint = (i+j)/2
* pval = isa.arr[self.sa.arr[midpoint] + h]
* if i != midpoint: # <<<<<<<<<<<<<<
@@ -37506,7 +39802,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = ((__pyx_v_i != __pyx_v_midpoint) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":126
+ /* "cdec/sa/suffix_array.pxi":126
* pval = isa.arr[self.sa.arr[midpoint] + h]
* if i != midpoint:
* tmp = self.sa.arr[midpoint] # <<<<<<<<<<<<<<
@@ -37515,7 +39811,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_midpoint]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":127
+ /* "cdec/sa/suffix_array.pxi":127
* if i != midpoint:
* tmp = self.sa.arr[midpoint]
* self.sa.arr[midpoint] = self.sa.arr[i] # <<<<<<<<<<<<<<
@@ -37524,7 +39820,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[__pyx_v_midpoint]) = (__pyx_v_self->sa->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":128
+ /* "cdec/sa/suffix_array.pxi":128
* tmp = self.sa.arr[midpoint]
* self.sa.arr[midpoint] = self.sa.arr[i]
* self.sa.arr[i] = tmp # <<<<<<<<<<<<<<
@@ -37536,7 +39832,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":129
+ /* "cdec/sa/suffix_array.pxi":129
* self.sa.arr[midpoint] = self.sa.arr[i]
* self.sa.arr[i] = tmp
* phead = i # <<<<<<<<<<<<<<
@@ -37545,7 +39841,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_phead = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":130
+ /* "cdec/sa/suffix_array.pxi":130
* self.sa.arr[i] = tmp
* phead = i
* ptail = i # <<<<<<<<<<<<<<
@@ -37554,7 +39850,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_ptail = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":134
+ /* "cdec/sa/suffix_array.pxi":134
* # find the three partitions. phead marks the first element
* # of the middle partition, and ptail marks the last element
* for k from i+1 <= k < j+1: # <<<<<<<<<<<<<<
@@ -37564,7 +39860,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_5 = (__pyx_v_j + 1);
for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_5; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":135
+ /* "cdec/sa/suffix_array.pxi":135
* # of the middle partition, and ptail marks the last element
* for k from i+1 <= k < j+1:
* if isa.arr[self.sa.arr[k] + h] < pval: # <<<<<<<<<<<<<<
@@ -37574,7 +39870,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = (((__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_k]) + __pyx_v_h)]) < __pyx_v_pval) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":136
+ /* "cdec/sa/suffix_array.pxi":136
* for k from i+1 <= k < j+1:
* if isa.arr[self.sa.arr[k] + h] < pval:
* if k > ptail+1: # <<<<<<<<<<<<<<
@@ -37584,7 +39880,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":137
+ /* "cdec/sa/suffix_array.pxi":137
* if isa.arr[self.sa.arr[k] + h] < pval:
* if k > ptail+1:
* tmp = self.sa.arr[phead] # <<<<<<<<<<<<<<
@@ -37593,7 +39889,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":138
+ /* "cdec/sa/suffix_array.pxi":138
* if k > ptail+1:
* tmp = self.sa.arr[phead]
* self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<<
@@ -37602,7 +39898,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":139
+ /* "cdec/sa/suffix_array.pxi":139
* tmp = self.sa.arr[phead]
* self.sa.arr[phead] = self.sa.arr[k]
* self.sa.arr[k] = self.sa.arr[ptail+1] # <<<<<<<<<<<<<<
@@ -37611,7 +39907,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[__pyx_v_k]) = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":140
+ /* "cdec/sa/suffix_array.pxi":140
* self.sa.arr[phead] = self.sa.arr[k]
* self.sa.arr[k] = self.sa.arr[ptail+1]
* self.sa.arr[ptail+1] = tmp # <<<<<<<<<<<<<<
@@ -37623,7 +39919,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":142
+ /* "cdec/sa/suffix_array.pxi":142
* self.sa.arr[ptail+1] = tmp
* else: # k == ptail+1
* tmp = self.sa.arr[phead] # <<<<<<<<<<<<<<
@@ -37632,7 +39928,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":143
+ /* "cdec/sa/suffix_array.pxi":143
* else: # k == ptail+1
* tmp = self.sa.arr[phead]
* self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<<
@@ -37641,7 +39937,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":144
+ /* "cdec/sa/suffix_array.pxi":144
* tmp = self.sa.arr[phead]
* self.sa.arr[phead] = self.sa.arr[k]
* self.sa.arr[k] = tmp # <<<<<<<<<<<<<<
@@ -37652,7 +39948,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
__pyx_L10:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":145
+ /* "cdec/sa/suffix_array.pxi":145
* self.sa.arr[phead] = self.sa.arr[k]
* self.sa.arr[k] = tmp
* phead = phead + 1 # <<<<<<<<<<<<<<
@@ -37661,7 +39957,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_phead = (__pyx_v_phead + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":146
+ /* "cdec/sa/suffix_array.pxi":146
* self.sa.arr[k] = tmp
* phead = phead + 1
* ptail = ptail + 1 # <<<<<<<<<<<<<<
@@ -37673,7 +39969,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":148
+ /* "cdec/sa/suffix_array.pxi":148
* ptail = ptail + 1
* else:
* if isa.arr[self.sa.arr[k] + h] == pval: # <<<<<<<<<<<<<<
@@ -37683,7 +39979,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = (((__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_k]) + __pyx_v_h)]) == __pyx_v_pval) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":149
+ /* "cdec/sa/suffix_array.pxi":149
* else:
* if isa.arr[self.sa.arr[k] + h] == pval:
* if k > ptail+1: # <<<<<<<<<<<<<<
@@ -37693,7 +39989,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":150
+ /* "cdec/sa/suffix_array.pxi":150
* if isa.arr[self.sa.arr[k] + h] == pval:
* if k > ptail+1:
* tmp = self.sa.arr[ptail+1] # <<<<<<<<<<<<<<
@@ -37702,7 +39998,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
__pyx_v_tmp = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":151
+ /* "cdec/sa/suffix_array.pxi":151
* if k > ptail+1:
* tmp = self.sa.arr[ptail+1]
* self.sa.arr[ptail+1] = self.sa.arr[k] # <<<<<<<<<<<<<<
@@ -37711,7 +40007,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
*/
(__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = (__pyx_v_self->sa->arr[__pyx_v_k]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":152
+ /* "cdec/sa/suffix_array.pxi":152
* tmp = self.sa.arr[ptail+1]
* self.sa.arr[ptail+1] = self.sa.arr[k]
* self.sa.arr[k] = tmp # <<<<<<<<<<<<<<
@@ -37723,7 +40019,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
__pyx_L12:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":153
+ /* "cdec/sa/suffix_array.pxi":153
* self.sa.arr[ptail+1] = self.sa.arr[k]
* self.sa.arr[k] = tmp
* ptail = ptail + 1 # <<<<<<<<<<<<<<
@@ -37738,47 +40034,62 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_L9:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":156
+ /* "cdec/sa/suffix_array.pxi":156
*
* # recursively sort smaller suffixes
* self.q3sort(i, phead-1, h, isa, pad+" ") # <<<<<<<<<<<<<<
*
* # update suffixes with pivot value
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_q3sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_q3sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_phead - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_v_phead - 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2);
+ __pyx_t_9 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ __pyx_t_11 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ if (__pyx_t_9) {
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(((PyObject *)__pyx_v_isa));
- PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_v_isa));
+ PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, ((PyObject *)__pyx_v_isa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_isa));
- PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_t_4 = 0;
+ PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__pyx_t_2 = 0;
__pyx_t_6 = 0;
__pyx_t_7 = 0;
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":160
+ /* "cdec/sa/suffix_array.pxi":160
* # update suffixes with pivot value
* # corresponds to update_group function in Larsson & Sadakane
* for k from phead <= k < ptail+1: # <<<<<<<<<<<<<<
@@ -37788,7 +40099,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_5 = (__pyx_v_ptail + 1);
for (__pyx_v_k = __pyx_v_phead; __pyx_v_k < __pyx_t_5; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":161
+ /* "cdec/sa/suffix_array.pxi":161
* # corresponds to update_group function in Larsson & Sadakane
* for k from phead <= k < ptail+1:
* isa.arr[self.sa.arr[k]] = ptail # <<<<<<<<<<<<<<
@@ -37798,7 +40109,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
(__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_k])]) = __pyx_v_ptail;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":162
+ /* "cdec/sa/suffix_array.pxi":162
* for k from phead <= k < ptail+1:
* isa.arr[self.sa.arr[k]] = ptail
* if phead == ptail: # <<<<<<<<<<<<<<
@@ -37808,7 +40119,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__pyx_t_1 = ((__pyx_v_phead == __pyx_v_ptail) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":163
+ /* "cdec/sa/suffix_array.pxi":163
* isa.arr[self.sa.arr[k]] = ptail
* if phead == ptail:
* self.sa.arr[phead] = -1 # <<<<<<<<<<<<<<
@@ -37820,47 +40131,62 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
}
__pyx_L15:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":166
+ /* "cdec/sa/suffix_array.pxi":166
*
* # recursively sort larger suffixes
* self.q3sort(ptail+1, j, h, isa, pad+" ") # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_q3sort); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_v_ptail + 1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_q3sort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_11 = __Pyx_PyInt_From_long((__pyx_v_ptail + 1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyNumber_Add(__pyx_v_pad, __pyx_kp_s__34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
+ __pyx_t_2 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(5+__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_2) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_10, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(((PyObject *)__pyx_v_isa));
- PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_isa));
+ PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_10, ((PyObject *)__pyx_v_isa));
__Pyx_GIVEREF(((PyObject *)__pyx_v_isa));
- PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_10, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_11 = 0;
__pyx_t_8 = 0;
- __pyx_t_3 = 0;
+ __pyx_t_7 = 0;
__pyx_t_6 = 0;
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":100
+ /* "cdec/sa/suffix_array.pxi":100
* logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time))
*
* def q3sort(self, int i, int j, int h, IntList isa, pad=""): # <<<<<<<<<<<<<<
@@ -37878,6 +40204,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -37886,7 +40214,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":169
+/* "cdec/sa/suffix_array.pxi":169
*
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -37926,34 +40254,53 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_text", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":170
+ /* "cdec/sa/suffix_array.pxi":170
*
* def write_text(self, char* filename):
* self.darray.write_text(filename) # <<<<<<<<<<<<<<
*
* def read_binary(self, char* filename):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_write_text); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_write_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":169
+ /* "cdec/sa/suffix_array.pxi":169
*
*
* def write_text(self, char* filename): # <<<<<<<<<<<<<<
@@ -37968,6 +40315,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -37976,7 +40325,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":172
+/* "cdec/sa/suffix_array.pxi":172
* self.darray.write_text(filename)
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -38016,7 +40365,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("read_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":174
+ /* "cdec/sa/suffix_array.pxi":174
* def read_binary(self, char* filename):
* cdef FILE *f
* f = fopen(filename, "r") # <<<<<<<<<<<<<<
@@ -38025,7 +40374,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_r);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":175
+ /* "cdec/sa/suffix_array.pxi":175
* cdef FILE *f
* f = fopen(filename, "r")
* self.darray.read_handle(f) # <<<<<<<<<<<<<<
@@ -38034,7 +40383,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":176
+ /* "cdec/sa/suffix_array.pxi":176
* f = fopen(filename, "r")
* self.darray.read_handle(f)
* self.sa.read_handle(f) # <<<<<<<<<<<<<<
@@ -38043,7 +40392,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":177
+ /* "cdec/sa/suffix_array.pxi":177
* self.darray.read_handle(f)
* self.sa.read_handle(f)
* self.ha.read_handle(f) # <<<<<<<<<<<<<<
@@ -38052,7 +40401,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":178
+ /* "cdec/sa/suffix_array.pxi":178
* self.sa.read_handle(f)
* self.ha.read_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -38061,7 +40410,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":172
+ /* "cdec/sa/suffix_array.pxi":172
* self.darray.write_text(filename)
*
* def read_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -38076,7 +40425,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":180
+/* "cdec/sa/suffix_array.pxi":180
* fclose(f)
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -38116,7 +40465,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("write_binary", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":182
+ /* "cdec/sa/suffix_array.pxi":182
* def write_binary(self, char* filename):
* cdef FILE* f
* f = fopen(filename, "w") # <<<<<<<<<<<<<<
@@ -38125,7 +40474,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
*/
__pyx_v_f = fopen(__pyx_v_filename, __pyx_k_w);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":183
+ /* "cdec/sa/suffix_array.pxi":183
* cdef FILE* f
* f = fopen(filename, "w")
* self.darray.write_handle(f) # <<<<<<<<<<<<<<
@@ -38134,7 +40483,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":184
+ /* "cdec/sa/suffix_array.pxi":184
* f = fopen(filename, "w")
* self.darray.write_handle(f)
* self.sa.write_handle(f) # <<<<<<<<<<<<<<
@@ -38143,7 +40492,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":185
+ /* "cdec/sa/suffix_array.pxi":185
* self.darray.write_handle(f)
* self.sa.write_handle(f)
* self.ha.write_handle(f) # <<<<<<<<<<<<<<
@@ -38152,7 +40501,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":186
+ /* "cdec/sa/suffix_array.pxi":186
* self.sa.write_handle(f)
* self.ha.write_handle(f)
* fclose(f) # <<<<<<<<<<<<<<
@@ -38161,7 +40510,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
*/
fclose(__pyx_v_f);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":180
+ /* "cdec/sa/suffix_array.pxi":180
* fclose(f)
*
* def write_binary(self, char* filename): # <<<<<<<<<<<<<<
@@ -38176,7 +40525,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(struct __p
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":188
+/* "cdec/sa/suffix_array.pxi":188
* fclose(f)
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -38223,18 +40572,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
- int __pyx_t_12;
- int __pyx_t_13;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *__pyx_t_13 = NULL;
+ int __pyx_t_14;
+ int __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("write_enhanced", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189
+ /* "cdec/sa/suffix_array.pxi":189
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -38257,75 +40608,109 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*try:*/ {
{
- __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
- __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
/*try:*/ {
- __Pyx_INCREF(__pyx_t_4);
__pyx_v_f = __pyx_t_4;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":190
+ /* "cdec/sa/suffix_array.pxi":190
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f:
* self.darray.write_enhanced_handle(f) # <<<<<<<<<<<<<<
* for a_i in self.sa:
* f.write("%d " % a_i)
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_write_enhanced_handle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->darray), __pyx_n_s_write_enhanced_handle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f);
- __Pyx_GIVEREF(__pyx_v_f);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ __Pyx_INCREF(__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_f);
+ __Pyx_GIVEREF(__pyx_v_f);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":191
+ /* "cdec/sa/suffix_array.pxi":191
* with open(filename, "w") as f:
* self.darray.write_enhanced_handle(f)
* for a_i in self.sa: # <<<<<<<<<<<<<<
* f.write("%d " % a_i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->sa)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sa))) {
- __pyx_t_2 = ((PyObject *)__pyx_v_self->sa); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->sa))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->sa))) {
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->sa); __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self->sa)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->sa)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_9(__pyx_t_2);
+ __pyx_t_1 = __pyx_t_10(__pyx_t_4);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -38339,77 +40724,104 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
__Pyx_XDECREF_SET(__pyx_v_a_i, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":192
+ /* "cdec/sa/suffix_array.pxi":192
* self.darray.write_enhanced_handle(f)
* for a_i in self.sa:
* f.write("%d " % a_i) # <<<<<<<<<<<<<<
* f.write("\n")
* for w_i in self.ha:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_a_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_a_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_11 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_11) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/suffix_array.pxi":191
+ * with open(filename, "w") as f:
+ * self.darray.write_enhanced_handle(f)
+ * for a_i in self.sa: # <<<<<<<<<<<<<<
+ * f.write("%d " % a_i)
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":193
+ /* "cdec/sa/suffix_array.pxi":193
* for a_i in self.sa:
* f.write("%d " % a_i)
* f.write("\n") # <<<<<<<<<<<<<<
* for w_i in self.ha:
* f.write("%d " % w_i)
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":194
+ /* "cdec/sa/suffix_array.pxi":194
* f.write("%d " % a_i)
* f.write("\n")
* for w_i in self.ha: # <<<<<<<<<<<<<<
* f.write("%d " % w_i)
* f.write("\n")
*/
- if (PyList_CheckExact(((PyObject *)__pyx_v_self->ha)) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->ha))) {
- __pyx_t_4 = ((PyObject *)__pyx_v_self->ha); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->ha))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->ha))) {
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->ha); __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(((PyObject *)__pyx_v_self->ha)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self->ha)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_4)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_9(__pyx_t_4);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_4 = __pyx_t_10(__pyx_t_1);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -38417,60 +40829,87 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __Pyx_XDECREF_SET(__pyx_v_w_i, __pyx_t_2);
- __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w_i, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":195
+ /* "cdec/sa/suffix_array.pxi":195
* f.write("\n")
* for w_i in self.ha:
* f.write("%d " % w_i) # <<<<<<<<<<<<<<
* f.write("\n")
*
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_w_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_v_w_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_2 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (!__pyx_t_2) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ __pyx_t_12 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/suffix_array.pxi":194
+ * f.write("%d " % a_i)
+ * f.write("\n")
+ * for w_i in self.ha: # <<<<<<<<<<<<<<
+ * f.write("%d " % w_i)
+ * f.write("\n")
+ */
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":196
+ /* "cdec/sa/suffix_array.pxi":196
* for w_i in self.ha:
* f.write("%d " % w_i)
* f.write("\n") # <<<<<<<<<<<<<<
*
* cdef int __search_high(self, int word_id, int offset, int low, int high):
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L14_try_end;
__pyx_L7_error:;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189
+ /* "cdec/sa/suffix_array.pxi":189
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -38479,69 +40918,69 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
*/
/*except:*/ {
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_4, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_Pack(3, __pyx_t_10, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11);
+ __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_12 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
- __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0);
- if (__pyx_t_13) {
- __Pyx_GIVEREF(__pyx_t_10);
+ if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
+ __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0);
+ if (__pyx_t_15) {
__Pyx_GIVEREF(__pyx_t_4);
- __Pyx_XGIVEREF(__pyx_t_1);
- __Pyx_ErrRestore(__pyx_t_10, __pyx_t_4, __pyx_t_1);
- __pyx_t_10 = 0; __pyx_t_4 = 0; __pyx_t_1 = 0;
+ __Pyx_GIVEREF(__pyx_t_1);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ErrRestore(__pyx_t_4, __pyx_t_1, __pyx_t_5);
+ __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L8_exception_handled;
}
__pyx_L9_except_error:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
goto __pyx_L1_error;
__pyx_L8_exception_handled:;
- __Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_XGIVEREF(__pyx_t_7);
- __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
__pyx_L14_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_3) {
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL);
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__59, NULL);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
goto __pyx_L6;
}
__pyx_L6:;
}
- goto __pyx_L23;
+ goto __pyx_L22;
__pyx_L3_error:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L1_error;
- __pyx_L23:;
+ __pyx_L22:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":188
+ /* "cdec/sa/suffix_array.pxi":188
* fclose(f)
*
* def write_enhanced(self, char* filename): # <<<<<<<<<<<<<<
@@ -38556,7 +40995,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -38568,7 +41009,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(struct _
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":198
+/* "cdec/sa/suffix_array.pxi":198
* f.write("\n")
*
* cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -38583,7 +41024,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
int __pyx_t_1;
__Pyx_RefNannySetupContext("__search_high", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":201
+ /* "cdec/sa/suffix_array.pxi":201
* cdef int midpoint
*
* if low >= high: # <<<<<<<<<<<<<<
@@ -38593,7 +41034,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
__pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":202
+ /* "cdec/sa/suffix_array.pxi":202
*
* if low >= high:
* return high # <<<<<<<<<<<<<<
@@ -38604,7 +41045,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":203
+ /* "cdec/sa/suffix_array.pxi":203
* if low >= high:
* return high
* midpoint = (high + low) / 2 # <<<<<<<<<<<<<<
@@ -38613,7 +41054,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
*/
__pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":204
+ /* "cdec/sa/suffix_array.pxi":204
* return high
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<<
@@ -38623,7 +41064,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
__pyx_t_1 = (((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":205
+ /* "cdec/sa/suffix_array.pxi":205
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id:
* return self.__search_high(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<<
@@ -38635,7 +41076,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":207
+ /* "cdec/sa/suffix_array.pxi":207
* return self.__search_high(word_id, offset, midpoint+1, high)
* else:
* return self.__search_high(word_id, offset, low, midpoint) # <<<<<<<<<<<<<<
@@ -38646,7 +41087,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":198
+ /* "cdec/sa/suffix_array.pxi":198
* f.write("\n")
*
* cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -38660,7 +41101,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":209
+/* "cdec/sa/suffix_array.pxi":209
* return self.__search_high(word_id, offset, low, midpoint)
*
* cdef int __search_low(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -38675,7 +41116,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
int __pyx_t_1;
__Pyx_RefNannySetupContext("__search_low", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":212
+ /* "cdec/sa/suffix_array.pxi":212
* cdef int midpoint
*
* if low >= high: # <<<<<<<<<<<<<<
@@ -38685,7 +41126,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
__pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":213
+ /* "cdec/sa/suffix_array.pxi":213
*
* if low >= high:
* return high # <<<<<<<<<<<<<<
@@ -38696,7 +41137,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":214
+ /* "cdec/sa/suffix_array.pxi":214
* if low >= high:
* return high
* midpoint = (high + low) / 2 # <<<<<<<<<<<<<<
@@ -38705,7 +41146,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
*/
__pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":215
+ /* "cdec/sa/suffix_array.pxi":215
* return high
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<<
@@ -38715,7 +41156,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
__pyx_t_1 = (((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":216
+ /* "cdec/sa/suffix_array.pxi":216
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id:
* return self.__search_low(word_id, offset, low, midpoint) # <<<<<<<<<<<<<<
@@ -38727,7 +41168,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":218
+ /* "cdec/sa/suffix_array.pxi":218
* return self.__search_low(word_id, offset, low, midpoint)
* else:
* return self.__search_low(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<<
@@ -38738,7 +41179,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":209
+ /* "cdec/sa/suffix_array.pxi":209
* return self.__search_high(word_id, offset, low, midpoint)
*
* cdef int __search_low(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -38752,7 +41193,7 @@ static int __pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":220
+/* "cdec/sa/suffix_array.pxi":220
* return self.__search_low(word_id, offset, midpoint+1, high)
*
* cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): # <<<<<<<<<<<<<<
@@ -38771,7 +41212,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_o
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get_range", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":221
+ /* "cdec/sa/suffix_array.pxi":221
*
* cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint):
* return (self.__search_low(word_id, offset, low, midpoint), # <<<<<<<<<<<<<<
@@ -38782,7 +41223,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_o
__pyx_t_1 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":222
+ /* "cdec/sa/suffix_array.pxi":222
* cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint):
* return (self.__search_low(word_id, offset, low, midpoint),
* self.__search_high(word_id, offset, midpoint, high)) # <<<<<<<<<<<<<<
@@ -38792,7 +41233,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_o
__pyx_t_2 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_midpoint, __pyx_v_high)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":221
+ /* "cdec/sa/suffix_array.pxi":221
*
* cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint):
* return (self.__search_low(word_id, offset, low, midpoint), # <<<<<<<<<<<<<<
@@ -38811,7 +41252,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_o
__pyx_t_3 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":220
+ /* "cdec/sa/suffix_array.pxi":220
* return self.__search_low(word_id, offset, midpoint+1, high)
*
* cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): # <<<<<<<<<<<<<<
@@ -38832,7 +41273,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":224
+/* "cdec/sa/suffix_array.pxi":224
* self.__search_high(word_id, offset, midpoint, high))
*
* cdef __lookup_helper(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -38853,7 +41294,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__lookup_helper", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":227
+ /* "cdec/sa/suffix_array.pxi":227
* cdef int midpoint
*
* if offset == 0: # <<<<<<<<<<<<<<
@@ -38863,7 +41304,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
__pyx_t_1 = ((__pyx_v_offset == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":228
+ /* "cdec/sa/suffix_array.pxi":228
*
* if offset == 0:
* return (self.ha.arr[word_id], self.ha.arr[word_id+1]) # <<<<<<<<<<<<<<
@@ -38888,7 +41329,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":229
+ /* "cdec/sa/suffix_array.pxi":229
* if offset == 0:
* return (self.ha.arr[word_id], self.ha.arr[word_id+1])
* if low >= high: # <<<<<<<<<<<<<<
@@ -38898,7 +41339,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
__pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":230
+ /* "cdec/sa/suffix_array.pxi":230
* return (self.ha.arr[word_id], self.ha.arr[word_id+1])
* if low >= high:
* return None # <<<<<<<<<<<<<<
@@ -38911,7 +41352,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":232
+ /* "cdec/sa/suffix_array.pxi":232
* return None
*
* midpoint = (high + low) / 2 # <<<<<<<<<<<<<<
@@ -38920,7 +41361,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
*/
__pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":233
+ /* "cdec/sa/suffix_array.pxi":233
*
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<<
@@ -38930,7 +41371,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
__pyx_t_1 = (((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) == __pyx_v_word_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":234
+ /* "cdec/sa/suffix_array.pxi":234
* midpoint = (high + low) / 2
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id:
* return self.__get_range(word_id, offset, low, high, midpoint) # <<<<<<<<<<<<<<
@@ -38945,7 +41386,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":235
+ /* "cdec/sa/suffix_array.pxi":235
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id:
* return self.__get_range(word_id, offset, low, high, midpoint)
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: # <<<<<<<<<<<<<<
@@ -38955,7 +41396,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
__pyx_t_1 = (((__pyx_v_self->darray->data->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_offset)]) > __pyx_v_word_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":236
+ /* "cdec/sa/suffix_array.pxi":236
* return self.__get_range(word_id, offset, low, high, midpoint)
* if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id:
* return self.__lookup_helper(word_id, offset, low, midpoint) # <<<<<<<<<<<<<<
@@ -38971,7 +41412,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":238
+ /* "cdec/sa/suffix_array.pxi":238
* return self.__lookup_helper(word_id, offset, low, midpoint)
* else:
* return self.__lookup_helper(word_id, offset, midpoint+1, high) # <<<<<<<<<<<<<<
@@ -38986,7 +41427,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":224
+ /* "cdec/sa/suffix_array.pxi":224
* self.__search_high(word_id, offset, midpoint, high))
*
* cdef __lookup_helper(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -39007,7 +41448,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper(struct __p
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":240
+/* "cdec/sa/suffix_array.pxi":240
* return self.__lookup_helper(word_id, offset, midpoint+1, high)
*
* def lookup(self, word, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -39108,7 +41549,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("lookup", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":242
+ /* "cdec/sa/suffix_array.pxi":242
* def lookup(self, word, int offset, int low, int high):
* cdef int wordid
* if low == -1: # <<<<<<<<<<<<<<
@@ -39118,7 +41559,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
__pyx_t_1 = ((__pyx_v_low == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":243
+ /* "cdec/sa/suffix_array.pxi":243
* cdef int wordid
* if low == -1:
* low = 0 # <<<<<<<<<<<<<<
@@ -39130,7 +41571,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":244
+ /* "cdec/sa/suffix_array.pxi":244
* if low == -1:
* low = 0
* if high == -1: # <<<<<<<<<<<<<<
@@ -39140,7 +41581,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
__pyx_t_1 = ((__pyx_v_high == -1) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":245
+ /* "cdec/sa/suffix_array.pxi":245
* low = 0
* if high == -1:
* high = len(self.sa) # <<<<<<<<<<<<<<
@@ -39156,7 +41597,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":246
+ /* "cdec/sa/suffix_array.pxi":246
* if high == -1:
* high = len(self.sa)
* if word in self.darray.word2id: # <<<<<<<<<<<<<<
@@ -39167,7 +41608,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
__pyx_t_4 = (__pyx_t_1 != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":247
+ /* "cdec/sa/suffix_array.pxi":247
* high = len(self.sa)
* if word in self.darray.word2id:
* word_id = self.darray.word2id[word] # <<<<<<<<<<<<<<
@@ -39179,7 +41620,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
__pyx_v_word_id = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":248
+ /* "cdec/sa/suffix_array.pxi":248
* if word in self.darray.word2id:
* word_id = self.darray.word2id[word]
* return self.__lookup_helper(word_id, offset, low, high) # <<<<<<<<<<<<<<
@@ -39196,7 +41637,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":250
+ /* "cdec/sa/suffix_array.pxi":250
* return self.__lookup_helper(word_id, offset, low, high)
* else:
* return None # <<<<<<<<<<<<<<
@@ -39207,7 +41648,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":240
+ /* "cdec/sa/suffix_array.pxi":240
* return self.__lookup_helper(word_id, offset, midpoint+1, high)
*
* def lookup(self, word, int offset, int low, int high): # <<<<<<<<<<<<<<
@@ -39227,7 +41668,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47
+/* "cdec/sa/rulefactory.pxi":47
* cdef public bilex
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -39251,7 +41692,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_se
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":54
+/* "cdec/sa/rulefactory.pxi":54
* self.phrases_f = defaultdict(int)
* self.phrases_e = defaultdict(int)
* self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<<
@@ -39260,43 +41701,60 @@ static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_se
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda1, METH_NOARGS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda3 = {"lambda3", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda3, METH_NOARGS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
- __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self);
+ __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda1", 0);
+ __Pyx_RefNannySetupContext("lambda3", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyInt_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
@@ -39304,7 +41762,8 @@ static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -39312,7 +41771,7 @@ static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":55
+/* "cdec/sa/rulefactory.pxi":55
* self.phrases_e = defaultdict(int)
* self.phrases_fe = defaultdict(lambda: defaultdict(int))
* self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<<
@@ -39321,43 +41780,60 @@ static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda2, METH_NOARGS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda4 = {"lambda4", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda4, METH_NOARGS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0);
- __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self);
+ __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda2", 0);
+ __Pyx_RefNannySetupContext("lambda4", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyTuple_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyTuple_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyTuple_Type))));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyTuple_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyTuple_Type))));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PyTuple_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyTuple_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
@@ -39365,7 +41841,8 @@ static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -39373,7 +41850,7 @@ static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47
+/* "cdec/sa/rulefactory.pxi":47
* cdef public bilex
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -39387,52 +41864,86 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cde
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":49
+ /* "cdec/sa/rulefactory.pxi":49
* def __cinit__(self):
* # Keep track of everything that can be sampled:
* self.samples_f = defaultdict(int) # <<<<<<<<<<<<<<
*
* # Phrase counts
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyInt_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->samples_f);
__Pyx_DECREF(__pyx_v_self->samples_f);
- __pyx_v_self->samples_f = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_self->samples_f = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":52
+ /* "cdec/sa/rulefactory.pxi":52
*
* # Phrase counts
* self.phrases_f = defaultdict(int) # <<<<<<<<<<<<<<
* self.phrases_e = defaultdict(int)
* self.phrases_fe = defaultdict(lambda: defaultdict(int))
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyInt_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->phrases_f);
@@ -39440,57 +41951,90 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cde
__pyx_v_self->phrases_f = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":53
+ /* "cdec/sa/rulefactory.pxi":53
* # Phrase counts
* self.phrases_f = defaultdict(int)
* self.phrases_e = defaultdict(int) # <<<<<<<<<<<<<<
* self.phrases_fe = defaultdict(lambda: defaultdict(int))
* self.phrases_al = defaultdict(lambda: defaultdict(tuple))
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyInt_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PyInt_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->phrases_e);
__Pyx_DECREF(__pyx_v_self->phrases_e);
- __pyx_v_self->phrases_e = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_self->phrases_e = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":54
+ /* "cdec/sa/rulefactory.pxi":54
* self.phrases_f = defaultdict(int)
* self.phrases_e = defaultdict(int)
* self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<<
* self.phrases_al = defaultdict(lambda: defaultdict(tuple))
*
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda1, 0, __pyx_n_s_cinit___locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___lambda3, 0, __pyx_n_s_cinit___locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->phrases_fe);
__Pyx_DECREF(__pyx_v_self->phrases_fe);
- __pyx_v_self->phrases_fe = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_self->phrases_fe = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":55
+ /* "cdec/sa/rulefactory.pxi":55
* self.phrases_e = defaultdict(int)
* self.phrases_fe = defaultdict(lambda: defaultdict(int))
* self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<<
@@ -39499,42 +42043,74 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cde
*/
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda2, 0, __pyx_n_s_cinit___locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___1lambda4, 0, __pyx_n_s_cinit___locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->phrases_al);
__Pyx_DECREF(__pyx_v_self->phrases_al);
__pyx_v_self->phrases_al = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":58
+ /* "cdec/sa/rulefactory.pxi":58
*
* # Instance-specific bilex
* self.bilex = Bilex() # <<<<<<<<<<<<<<
*
* cdef int PRECOMPUTE = 0
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Bilex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Bilex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_GIVEREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_v_self->bilex);
__Pyx_DECREF(__pyx_v_self->bilex);
- __pyx_v_self->bilex = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_v_self->bilex = __pyx_t_1;
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47
+ /* "cdec/sa/rulefactory.pxi":47
* cdef public bilex
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -39549,6 +42125,8 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cde
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -39556,7 +42134,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cde
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":40
+/* "cdec/sa/rulefactory.pxi":40
*
* cdef class OnlineStats:
* cdef public samples_f # <<<<<<<<<<<<<<
@@ -39651,7 +42229,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":41
+/* "cdec/sa/rulefactory.pxi":41
* cdef class OnlineStats:
* cdef public samples_f
* cdef public phrases_f # <<<<<<<<<<<<<<
@@ -39746,7 +42324,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":42
+/* "cdec/sa/rulefactory.pxi":42
* cdef public samples_f
* cdef public phrases_f
* cdef public phrases_e # <<<<<<<<<<<<<<
@@ -39841,7 +42419,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":43
+/* "cdec/sa/rulefactory.pxi":43
* cdef public phrases_f
* cdef public phrases_e
* cdef public phrases_fe # <<<<<<<<<<<<<<
@@ -39936,7 +42514,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":44
+/* "cdec/sa/rulefactory.pxi":44
* cdef public phrases_e
* cdef public phrases_fe
* cdef public phrases_al # <<<<<<<<<<<<<<
@@ -40031,7 +42609,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":45
+/* "cdec/sa/rulefactory.pxi":45
* cdef public phrases_fe
* cdef public phrases_al
* cdef public bilex # <<<<<<<<<<<<<<
@@ -40126,7 +42704,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_5bilex_4__del__(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":70
+/* "cdec/sa/rulefactory.pxi":70
* cdef public children
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -40159,7 +42737,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2s
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":71
+ /* "cdec/sa/rulefactory.pxi":71
*
* def __cinit__(self):
* self.children = {} # <<<<<<<<<<<<<<
@@ -40174,7 +42752,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2s
__pyx_v_self->children = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":70
+ /* "cdec/sa/rulefactory.pxi":70
* cdef public children
*
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -40194,7 +42772,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":68
+/* "cdec/sa/rulefactory.pxi":68
*
* cdef class TrieNode:
* cdef public children # <<<<<<<<<<<<<<
@@ -40289,7 +42867,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":78
+/* "cdec/sa/rulefactory.pxi":78
* cdef public suffix_link
*
* def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<<
@@ -40379,7 +42957,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":79
+ /* "cdec/sa/rulefactory.pxi":79
*
* def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None):
* self.phrase = phrase # <<<<<<<<<<<<<<
@@ -40392,7 +42970,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj
__Pyx_DECREF(__pyx_v_self->phrase);
__pyx_v_self->phrase = __pyx_v_phrase;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":80
+ /* "cdec/sa/rulefactory.pxi":80
* def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None):
* self.phrase = phrase
* self.phrase_location = phrase_location # <<<<<<<<<<<<<<
@@ -40405,7 +42983,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj
__Pyx_DECREF(__pyx_v_self->phrase_location);
__pyx_v_self->phrase_location = __pyx_v_phrase_location;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":81
+ /* "cdec/sa/rulefactory.pxi":81
* self.phrase = phrase
* self.phrase_location = phrase_location
* self.suffix_link = suffix_link # <<<<<<<<<<<<<<
@@ -40418,7 +42996,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj
__Pyx_DECREF(__pyx_v_self->suffix_link);
__pyx_v_self->suffix_link = __pyx_v_suffix_link;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":78
+ /* "cdec/sa/rulefactory.pxi":78
* cdef public suffix_link
*
* def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<<
@@ -40432,7 +43010,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":74
+/* "cdec/sa/rulefactory.pxi":74
*
* cdef class ExtendedTrieNode(TrieNode):
* cdef public phrase # <<<<<<<<<<<<<<
@@ -40527,7 +43105,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":75
+/* "cdec/sa/rulefactory.pxi":75
* cdef class ExtendedTrieNode(TrieNode):
* cdef public phrase
* cdef public phrase_location # <<<<<<<<<<<<<<
@@ -40622,7 +43200,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":76
+/* "cdec/sa/rulefactory.pxi":76
* cdef public phrase
* cdef public phrase_location
* cdef public suffix_link # <<<<<<<<<<<<<<
@@ -40717,7 +43295,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(str
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":88
+/* "cdec/sa/rulefactory.pxi":88
* cdef public int count
* cdef public root
* def __cinit__(self, extended=False): # <<<<<<<<<<<<<<
@@ -40793,7 +43371,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":89
+ /* "cdec/sa/rulefactory.pxi":89
* cdef public root
* def __cinit__(self, extended=False):
* self.count = 0 # <<<<<<<<<<<<<<
@@ -40802,7 +43380,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
*/
__pyx_v_self->count = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":90
+ /* "cdec/sa/rulefactory.pxi":90
* def __cinit__(self, extended=False):
* self.count = 0
* self.extended = extended # <<<<<<<<<<<<<<
@@ -40812,7 +43390,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->extended = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":91
+ /* "cdec/sa/rulefactory.pxi":91
* self.count = 0
* self.extended = extended
* if extended: # <<<<<<<<<<<<<<
@@ -40822,7 +43400,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":92
+ /* "cdec/sa/rulefactory.pxi":92
* self.extended = extended
* if extended:
* self.root = ExtendedTrieNode() # <<<<<<<<<<<<<<
@@ -40840,7 +43418,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":94
+ /* "cdec/sa/rulefactory.pxi":94
* self.root = ExtendedTrieNode()
* else:
* self.root = TrieNode() # <<<<<<<<<<<<<<
@@ -40857,7 +43435,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":88
+ /* "cdec/sa/rulefactory.pxi":88
* cdef public int count
* cdef public root
* def __cinit__(self, extended=False): # <<<<<<<<<<<<<<
@@ -40877,7 +43455,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":85
+/* "cdec/sa/rulefactory.pxi":85
*
* cdef class TrieTable:
* cdef public int extended # <<<<<<<<<<<<<<
@@ -40959,7 +43537,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_ob
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":86
+/* "cdec/sa/rulefactory.pxi":86
* cdef class TrieTable:
* cdef public int extended
* cdef public int count # <<<<<<<<<<<<<<
@@ -41041,7 +43619,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":87
+/* "cdec/sa/rulefactory.pxi":87
* cdef public int extended
* cdef public int count
* cdef public root # <<<<<<<<<<<<<<
@@ -41136,7 +43714,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":114
+/* "cdec/sa/rulefactory.pxi":114
*
* # returns true if sent_id is contained
* cdef int contains(self, int sent_id): # <<<<<<<<<<<<<<
@@ -41149,7 +43727,7 @@ static int __pyx_f_4cdec_2sa_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("contains", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":115
+ /* "cdec/sa/rulefactory.pxi":115
* # returns true if sent_id is contained
* cdef int contains(self, int sent_id):
* return 1 # <<<<<<<<<<<<<<
@@ -41159,7 +43737,7 @@ static int __pyx_f_4cdec_2sa_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct
__pyx_r = 1;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":114
+ /* "cdec/sa/rulefactory.pxi":114
*
* # returns true if sent_id is contained
* cdef int contains(self, int sent_id): # <<<<<<<<<<<<<<
@@ -41173,7 +43751,7 @@ static int __pyx_f_4cdec_2sa_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":117
+/* "cdec/sa/rulefactory.pxi":117
* return 1
*
* def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, # <<<<<<<<<<<<<<
@@ -41200,7 +43778,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sa_low,&__pyx_n_s_sa_high,&__pyx_n_s_arr_low,&__pyx_n_s_arr_high,&__pyx_n_s_arr,&__pyx_n_s_num_subpatterns,0};
PyObject* values[6] = {0,0,0,0,0,0};
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":118
+ /* "cdec/sa/rulefactory.pxi":118
*
* def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1,
* arr=None, int num_subpatterns=1): # <<<<<<<<<<<<<<
@@ -41306,7 +43884,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_v_self), __pyx_v_sa_low, __pyx_v_sa_high, __pyx_v_arr_low, __pyx_v_arr_high, __pyx_v_arr, __pyx_v_num_subpatterns);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":117
+ /* "cdec/sa/rulefactory.pxi":117
* return 1
*
* def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, # <<<<<<<<<<<<<<
@@ -41328,7 +43906,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":119
+ /* "cdec/sa/rulefactory.pxi":119
* def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1,
* arr=None, int num_subpatterns=1):
* self.sa_low = sa_low # <<<<<<<<<<<<<<
@@ -41337,7 +43915,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
*/
__pyx_v_self->sa_low = __pyx_v_sa_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":120
+ /* "cdec/sa/rulefactory.pxi":120
* arr=None, int num_subpatterns=1):
* self.sa_low = sa_low
* self.sa_high = sa_high # <<<<<<<<<<<<<<
@@ -41346,7 +43924,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
*/
__pyx_v_self->sa_high = __pyx_v_sa_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":121
+ /* "cdec/sa/rulefactory.pxi":121
* self.sa_low = sa_low
* self.sa_high = sa_high
* self.arr_low = arr_low # <<<<<<<<<<<<<<
@@ -41355,7 +43933,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
*/
__pyx_v_self->arr_low = __pyx_v_arr_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":122
+ /* "cdec/sa/rulefactory.pxi":122
* self.sa_high = sa_high
* self.arr_low = arr_low
* self.arr_high = arr_high # <<<<<<<<<<<<<<
@@ -41364,7 +43942,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
*/
__pyx_v_self->arr_high = __pyx_v_arr_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":123
+ /* "cdec/sa/rulefactory.pxi":123
* self.arr_low = arr_low
* self.arr_high = arr_high
* self.arr = arr # <<<<<<<<<<<<<<
@@ -41380,7 +43958,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
__pyx_v_self->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":124
+ /* "cdec/sa/rulefactory.pxi":124
* self.arr_high = arr_high
* self.arr = arr
* self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<<
@@ -41389,7 +43967,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
*/
__pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":117
+ /* "cdec/sa/rulefactory.pxi":117
* return 1
*
* def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, # <<<<<<<<<<<<<<
@@ -41409,7 +43987,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":134
+/* "cdec/sa/rulefactory.pxi":134
* cdef IntList sa
*
* def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<<
@@ -41490,12 +44068,15 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":135
+ /* "cdec/sa/rulefactory.pxi":135
*
* def __cinit__(self, int sample_size, SuffixArray fsarray):
* self.sample_size = sample_size # <<<<<<<<<<<<<<
@@ -41504,7 +44085,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
*/
__pyx_v_self->sample_size = __pyx_v_sample_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":136
+ /* "cdec/sa/rulefactory.pxi":136
* def __cinit__(self, int sample_size, SuffixArray fsarray):
* self.sample_size = sample_size
* self.sa = fsarray.sa # <<<<<<<<<<<<<<
@@ -41519,7 +44100,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
__pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":137
+ /* "cdec/sa/rulefactory.pxi":137
* self.sample_size = sample_size
* self.sa = fsarray.sa
* if sample_size > 0: # <<<<<<<<<<<<<<
@@ -41529,38 +44110,53 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
__pyx_t_2 = ((__pyx_v_sample_size > 0) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":138
+ /* "cdec/sa/rulefactory.pxi":138
* self.sa = fsarray.sa
* if sample_size > 0:
* logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) # <<<<<<<<<<<<<<
* else:
* logger.info("Sampling strategy: no sampling")
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_sample_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_sample_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Sampling_strategy_uniform_max_sa);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Sampling_strategy_uniform_max_sa);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Sampling_strategy_uniform_max_sa);
__Pyx_GIVEREF(__pyx_kp_s_Sampling_strategy_uniform_max_sa);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":140
+ /* "cdec/sa/rulefactory.pxi":140
* logger.info("Sampling strategy: uniform, max sample size = %d", sample_size)
* else:
* logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<<
@@ -41579,7 +44175,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":134
+ /* "cdec/sa/rulefactory.pxi":134
* cdef IntList sa
*
* def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<<
@@ -41594,6 +44190,8 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -41601,7 +44199,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":142
+/* "cdec/sa/rulefactory.pxi":142
* logger.info("Sampling strategy: no sampling")
*
* def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<<
@@ -41644,13 +44242,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sample", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":155
+ /* "cdec/sa/rulefactory.pxi":155
* cdef int num_locations, val, j
*
* sample = IntList() # <<<<<<<<<<<<<<
@@ -41662,7 +44259,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":156
+ /* "cdec/sa/rulefactory.pxi":156
*
* sample = IntList()
* if phrase_location.arr is None: # <<<<<<<<<<<<<<
@@ -41673,7 +44270,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
__pyx_t_3 = (__pyx_t_2 != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":157
+ /* "cdec/sa/rulefactory.pxi":157
* sample = IntList()
* if phrase_location.arr is None:
* num_locations = phrase_location.sa_high - phrase_location.sa_low # <<<<<<<<<<<<<<
@@ -41682,23 +44279,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
__pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":158
+ /* "cdec/sa/rulefactory.pxi":158
* if phrase_location.arr is None:
* num_locations = phrase_location.sa_high - phrase_location.sa_low
* if self.sample_size == -1 or num_locations <= self.sample_size: # <<<<<<<<<<<<<<
* sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations)
* else:
*/
- __pyx_t_3 = ((__pyx_v_self->sample_size == -1) != 0);
- if (!__pyx_t_3) {
- __pyx_t_2 = ((__pyx_v_num_locations <= __pyx_v_self->sample_size) != 0);
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_self->sample_size == -1) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L6_next_or;
} else {
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L6_next_or:;
+ __pyx_t_2 = ((__pyx_v_num_locations <= __pyx_v_self->sample_size) != 0);
+ __pyx_t_3 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":159
+ /* "cdec/sa/rulefactory.pxi":159
* num_locations = phrase_location.sa_high - phrase_location.sa_low
* if self.sample_size == -1 or num_locations <= self.sample_size:
* sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) # <<<<<<<<<<<<<<
@@ -41710,7 +44311,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":161
+ /* "cdec/sa/rulefactory.pxi":161
* sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations)
* else:
* stepsize = float(num_locations)/float(self.sample_size) # <<<<<<<<<<<<<<
@@ -41729,17 +44330,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
}
__pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":162
+ /* "cdec/sa/rulefactory.pxi":162
* else:
* stepsize = float(num_locations)/float(self.sample_size)
* i = phrase_location.sa_low # <<<<<<<<<<<<<<
* while i < phrase_location.sa_high and sample.len < self.sample_size:
* '''Note: int(i) not guaranteed to have the desired
*/
- __pyx_t_5 = __pyx_v_phrase_location->sa_low;
- __pyx_v_i = __pyx_t_5;
+ __pyx_t_4 = __pyx_v_phrase_location->sa_low;
+ __pyx_v_i = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":163
+ /* "cdec/sa/rulefactory.pxi":163
* stepsize = float(num_locations)/float(self.sample_size)
* i = phrase_location.sa_low
* while i < phrase_location.sa_high and sample.len < self.sample_size: # <<<<<<<<<<<<<<
@@ -41747,26 +44348,30 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
* effect, according to the python documentation'''
*/
while (1) {
- __pyx_t_4 = ((__pyx_v_i < __pyx_v_phrase_location->sa_high) != 0);
- if (__pyx_t_4) {
- __pyx_t_3 = ((__pyx_v_sample->len < __pyx_v_self->sample_size) != 0);
- __pyx_t_2 = __pyx_t_3;
+ __pyx_t_2 = ((__pyx_v_i < __pyx_v_phrase_location->sa_high) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L10_next_and;
} else {
- __pyx_t_2 = __pyx_t_4;
+ __pyx_t_3 = __pyx_t_2;
+ goto __pyx_L9_bool_binop_done;
}
- if (!__pyx_t_2) break;
+ __pyx_L10_next_and:;
+ __pyx_t_2 = ((__pyx_v_sample->len < __pyx_v_self->sample_size) != 0);
+ __pyx_t_3 = __pyx_t_2;
+ __pyx_L9_bool_binop_done:;
+ if (!__pyx_t_3) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":166
+ /* "cdec/sa/rulefactory.pxi":166
* '''Note: int(i) not guaranteed to have the desired
* effect, according to the python documentation'''
* if fmod(i,1.0) > 0.5: # <<<<<<<<<<<<<<
* val = int(ceil(i))
* else:
*/
- __pyx_t_2 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0);
- if (__pyx_t_2) {
+ __pyx_t_3 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":167
+ /* "cdec/sa/rulefactory.pxi":167
* effect, according to the python documentation'''
* if fmod(i,1.0) > 0.5:
* val = int(ceil(i)) # <<<<<<<<<<<<<<
@@ -41774,11 +44379,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
* val = int(floor(i))
*/
__pyx_v_val = ((int)ceil(__pyx_v_i));
- goto __pyx_L7;
+ goto __pyx_L11;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":169
+ /* "cdec/sa/rulefactory.pxi":169
* val = int(ceil(i))
* else:
* val = int(floor(i)) # <<<<<<<<<<<<<<
@@ -41787,9 +44392,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
__pyx_v_val = ((int)floor(__pyx_v_i));
}
- __pyx_L7:;
+ __pyx_L11:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":170
+ /* "cdec/sa/rulefactory.pxi":170
* else:
* val = int(floor(i))
* sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<<
@@ -41798,7 +44403,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_append(__pyx_v_sample, (__pyx_v_self->sa->arr[__pyx_v_val]));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":171
+ /* "cdec/sa/rulefactory.pxi":171
* val = int(floor(i))
* sample._append(self.sa.arr[val])
* i = i + stepsize # <<<<<<<<<<<<<<
@@ -41813,14 +44418,14 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":173
+ /* "cdec/sa/rulefactory.pxi":173
* i = i + stepsize
* else:
* num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns # <<<<<<<<<<<<<<
* if self.sample_size == -1 or num_locations <= self.sample_size:
* sample = phrase_location.arr
*/
- __pyx_t_5 = (__pyx_v_phrase_location->arr_high - __pyx_v_phrase_location->arr_low);
+ __pyx_t_4 = (__pyx_v_phrase_location->arr_high - __pyx_v_phrase_location->arr_low);
if (unlikely(__pyx_v_phrase_location->num_subpatterns == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -41831,7 +44436,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_phrase_location->num_subpatterns == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) {
+ else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_phrase_location->num_subpatterns == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
@@ -41841,9 +44446,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns);
+ __pyx_v_num_locations = __Pyx_div_int(__pyx_t_4, __pyx_v_phrase_location->num_subpatterns);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":174
+ /* "cdec/sa/rulefactory.pxi":174
* else:
* num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns
* if self.sample_size == -1 or num_locations <= self.sample_size: # <<<<<<<<<<<<<<
@@ -41852,14 +44457,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
__pyx_t_2 = ((__pyx_v_self->sample_size == -1) != 0);
if (!__pyx_t_2) {
- __pyx_t_4 = ((__pyx_v_num_locations <= __pyx_v_self->sample_size) != 0);
- __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L14_next_or;
} else {
__pyx_t_3 = __pyx_t_2;
+ goto __pyx_L13_bool_binop_done;
}
+ __pyx_L14_next_or:;
+ __pyx_t_2 = ((__pyx_v_num_locations <= __pyx_v_self->sample_size) != 0);
+ __pyx_t_3 = __pyx_t_2;
+ __pyx_L13_bool_binop_done:;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":175
+ /* "cdec/sa/rulefactory.pxi":175
* num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns
* if self.sample_size == -1 or num_locations <= self.sample_size:
* sample = phrase_location.arr # <<<<<<<<<<<<<<
@@ -41870,11 +44479,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
__Pyx_INCREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_sample, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
__pyx_t_1 = 0;
- goto __pyx_L8;
+ goto __pyx_L12;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":177
+ /* "cdec/sa/rulefactory.pxi":177
* sample = phrase_location.arr
* else:
* stepsize = float(num_locations)/float(self.sample_size) # <<<<<<<<<<<<<<
@@ -41893,17 +44502,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
}
__pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":178
+ /* "cdec/sa/rulefactory.pxi":178
* else:
* stepsize = float(num_locations)/float(self.sample_size)
* i = phrase_location.arr_low # <<<<<<<<<<<<<<
* while i < num_locations and sample.len < self.sample_size * phrase_location.num_subpatterns:
* '''Note: int(i) not guaranteed to have the desired
*/
- __pyx_t_5 = __pyx_v_phrase_location->arr_low;
- __pyx_v_i = __pyx_t_5;
+ __pyx_t_4 = __pyx_v_phrase_location->arr_low;
+ __pyx_v_i = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":179
+ /* "cdec/sa/rulefactory.pxi":179
* stepsize = float(num_locations)/float(self.sample_size)
* i = phrase_location.arr_low
* while i < num_locations and sample.len < self.sample_size * phrase_location.num_subpatterns: # <<<<<<<<<<<<<<
@@ -41911,26 +44520,30 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
* effect, according to the python documentation'''
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_i < __pyx_v_num_locations) != 0);
- if (__pyx_t_3) {
- __pyx_t_2 = ((__pyx_v_sample->len < (__pyx_v_self->sample_size * __pyx_v_phrase_location->num_subpatterns)) != 0);
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_i < __pyx_v_num_locations) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L18_next_and;
} else {
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_2;
+ goto __pyx_L17_bool_binop_done;
}
- if (!__pyx_t_4) break;
+ __pyx_L18_next_and:;
+ __pyx_t_2 = ((__pyx_v_sample->len < (__pyx_v_self->sample_size * __pyx_v_phrase_location->num_subpatterns)) != 0);
+ __pyx_t_3 = __pyx_t_2;
+ __pyx_L17_bool_binop_done:;
+ if (!__pyx_t_3) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":182
+ /* "cdec/sa/rulefactory.pxi":182
* '''Note: int(i) not guaranteed to have the desired
* effect, according to the python documentation'''
* if fmod(i,1.0) > 0.5: # <<<<<<<<<<<<<<
* val = int(ceil(i))
* else:
*/
- __pyx_t_4 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":183
+ /* "cdec/sa/rulefactory.pxi":183
* effect, according to the python documentation'''
* if fmod(i,1.0) > 0.5:
* val = int(ceil(i)) # <<<<<<<<<<<<<<
@@ -41938,11 +44551,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
* val = int(floor(i))
*/
__pyx_v_val = ((int)ceil(__pyx_v_i));
- goto __pyx_L11;
+ goto __pyx_L19;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":185
+ /* "cdec/sa/rulefactory.pxi":185
* val = int(ceil(i))
* else:
* val = int(floor(i)) # <<<<<<<<<<<<<<
@@ -41951,9 +44564,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
__pyx_v_val = ((int)floor(__pyx_v_i));
}
- __pyx_L11:;
+ __pyx_L19:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":186
+ /* "cdec/sa/rulefactory.pxi":186
* else:
* val = int(floor(i))
* j = phrase_location.arr_low + (val*phrase_location.num_subpatterns) # <<<<<<<<<<<<<<
@@ -41962,7 +44575,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
__pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":187
+ /* "cdec/sa/rulefactory.pxi":187
* val = int(floor(i))
* j = phrase_location.arr_low + (val*phrase_location.num_subpatterns)
* sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) # <<<<<<<<<<<<<<
@@ -41971,7 +44584,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_phrase_location->arr->arr + __pyx_v_j), __pyx_v_phrase_location->num_subpatterns);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":188
+ /* "cdec/sa/rulefactory.pxi":188
* j = phrase_location.arr_low + (val*phrase_location.num_subpatterns)
* sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns)
* i = i + stepsize # <<<<<<<<<<<<<<
@@ -41981,11 +44594,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
__pyx_v_i = (__pyx_v_i + __pyx_v_stepsize);
}
}
- __pyx_L8:;
+ __pyx_L12:;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":189
+ /* "cdec/sa/rulefactory.pxi":189
* sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns)
* i = i + stepsize
* return sample # <<<<<<<<<<<<<<
@@ -41997,7 +44610,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
__pyx_r = ((PyObject *)__pyx_v_sample);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":142
+ /* "cdec/sa/rulefactory.pxi":142
* logger.info("Sampling strategy: no sampling")
*
* def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<<
@@ -42017,7 +44630,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":201
+/* "cdec/sa/rulefactory.pxi":201
*
*
* cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<<
@@ -42029,7 +44642,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("assign_matching", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":202
+ /* "cdec/sa/rulefactory.pxi":202
*
* cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr):
* m.arr = arr # <<<<<<<<<<<<<<
@@ -42038,7 +44651,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
*/
__pyx_v_m->arr = __pyx_v_arr;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":203
+ /* "cdec/sa/rulefactory.pxi":203
* cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr):
* m.arr = arr
* m.start = start # <<<<<<<<<<<<<<
@@ -42047,7 +44660,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
*/
__pyx_v_m->start = __pyx_v_start;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":204
+ /* "cdec/sa/rulefactory.pxi":204
* m.arr = arr
* m.start = start
* m.end = start + step # <<<<<<<<<<<<<<
@@ -42056,7 +44669,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
*/
__pyx_v_m->end = (__pyx_v_start + __pyx_v_step);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":205
+ /* "cdec/sa/rulefactory.pxi":205
* m.start = start
* m.end = start + step
* m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<<
@@ -42065,7 +44678,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
*/
__pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":206
+ /* "cdec/sa/rulefactory.pxi":206
* m.end = start + step
* m.sent_id = sent_id_arr[arr[start]]
* m.size = step # <<<<<<<<<<<<<<
@@ -42074,7 +44687,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
*/
__pyx_v_m->size = __pyx_v_step;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":201
+ /* "cdec/sa/rulefactory.pxi":201
*
*
* cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<<
@@ -42086,7 +44699,7 @@ static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":209
+/* "cdec/sa/rulefactory.pxi":209
*
*
* cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<<
@@ -42103,7 +44716,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
int __pyx_t_2;
__Pyx_RefNannySetupContext("append_combined_matching", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":213
+ /* "cdec/sa/rulefactory.pxi":213
* cdef int i, new_len
*
* new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<<
@@ -42112,7 +44725,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
*/
__pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":214
+ /* "cdec/sa/rulefactory.pxi":214
*
* new_len = result_len[0] + num_subpatterns
* arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -42121,7 +44734,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
*/
__pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":216
+ /* "cdec/sa/rulefactory.pxi":216
* arr = <int*> realloc(arr, new_len*sizeof(int))
*
* for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<<
@@ -42131,7 +44744,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
__pyx_t_1 = __pyx_v_loc1->size;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":217
+ /* "cdec/sa/rulefactory.pxi":217
*
* for i from 0 <= i < loc1.size:
* arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<<
@@ -42141,7 +44754,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
(__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":218
+ /* "cdec/sa/rulefactory.pxi":218
* for i from 0 <= i < loc1.size:
* arr[result_len[0]+i] = loc1.arr[loc1.start+i]
* if num_subpatterns > loc1.size: # <<<<<<<<<<<<<<
@@ -42151,7 +44764,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
__pyx_t_2 = ((__pyx_v_num_subpatterns > __pyx_v_loc1->size) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":219
+ /* "cdec/sa/rulefactory.pxi":219
* arr[result_len[0]+i] = loc1.arr[loc1.start+i]
* if num_subpatterns > loc1.size:
* arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<<
@@ -42163,7 +44776,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":220
+ /* "cdec/sa/rulefactory.pxi":220
* if num_subpatterns > loc1.size:
* arr[new_len-1] = loc2.arr[loc2.end-1]
* result_len[0] = new_len # <<<<<<<<<<<<<<
@@ -42172,7 +44785,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
*/
(__pyx_v_result_len[0]) = __pyx_v_new_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":221
+ /* "cdec/sa/rulefactory.pxi":221
* arr[new_len-1] = loc2.arr[loc2.end-1]
* result_len[0] = new_len
* return arr # <<<<<<<<<<<<<<
@@ -42182,7 +44795,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
__pyx_r = __pyx_v_arr;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":209
+ /* "cdec/sa/rulefactory.pxi":209
*
*
* cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<<
@@ -42196,7 +44809,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, st
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":224
+/* "cdec/sa/rulefactory.pxi":224
*
*
* cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<<
@@ -42210,7 +44823,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("extend_arr", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":227
+ /* "cdec/sa/rulefactory.pxi":227
* cdef int new_len
*
* new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<<
@@ -42219,7 +44832,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
*/
__pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":228
+ /* "cdec/sa/rulefactory.pxi":228
*
* new_len = arr_len[0] + appendix_len
* arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -42228,7 +44841,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
*/
__pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":229
+ /* "cdec/sa/rulefactory.pxi":229
* new_len = arr_len[0] + appendix_len
* arr = <int*> realloc(arr, new_len*sizeof(int))
* memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -42237,7 +44850,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
*/
memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":230
+ /* "cdec/sa/rulefactory.pxi":230
* arr = <int*> realloc(arr, new_len*sizeof(int))
* memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int))
* arr_len[0] = new_len # <<<<<<<<<<<<<<
@@ -42246,7 +44859,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
*/
(__pyx_v_arr_len[0]) = __pyx_v_new_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":231
+ /* "cdec/sa/rulefactory.pxi":231
* memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int))
* arr_len[0] = new_len
* return arr # <<<<<<<<<<<<<<
@@ -42256,7 +44869,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
__pyx_r = __pyx_v_arr;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":224
+ /* "cdec/sa/rulefactory.pxi":224
*
*
* cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<<
@@ -42270,7 +44883,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":233
+/* "cdec/sa/rulefactory.pxi":233
* return arr
*
* cdef int median(int low, int high, int step): # <<<<<<<<<<<<<<
@@ -42287,7 +44900,7 @@ static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("median", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":234
+ /* "cdec/sa/rulefactory.pxi":234
*
* cdef int median(int low, int high, int step):
* return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<<
@@ -42318,7 +44931,7 @@ static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int
__pyx_r = (__pyx_v_low + (__Pyx_div_long(__Pyx_div_int(__pyx_t_1, __pyx_v_step), 2) * __pyx_v_step));
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":233
+ /* "cdec/sa/rulefactory.pxi":233
* return arr
*
* cdef int median(int low, int high, int step): # <<<<<<<<<<<<<<
@@ -42335,7 +44948,7 @@ static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":237
+/* "cdec/sa/rulefactory.pxi":237
*
*
* cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<<
@@ -42347,10 +44960,9 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("find_comparable_matchings", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":241
+ /* "cdec/sa/rulefactory.pxi":241
* # in which all matchings have the same first index as the one
* # starting at loc
* loc_plus[0] = loc + step # <<<<<<<<<<<<<<
@@ -42359,7 +44971,7 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
*/
(__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":242
+ /* "cdec/sa/rulefactory.pxi":242
* # starting at loc
* loc_plus[0] = loc + step
* while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<<
@@ -42367,16 +44979,20 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
* loc_minus[0] = loc
*/
while (1) {
- __pyx_t_1 = (((__pyx_v_loc_plus[0]) < __pyx_v_high) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = (((__pyx_v_arr[(__pyx_v_loc_plus[0])]) == (__pyx_v_arr[__pyx_v_loc])) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = (((__pyx_v_loc_plus[0]) < __pyx_v_high) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L6_next_and;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (!__pyx_t_3) break;
+ __pyx_L6_next_and:;
+ __pyx_t_2 = (((__pyx_v_arr[(__pyx_v_loc_plus[0])]) == (__pyx_v_arr[__pyx_v_loc])) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":243
+ /* "cdec/sa/rulefactory.pxi":243
* loc_plus[0] = loc + step
* while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]:
* loc_plus[0] = loc_plus[0] + step # <<<<<<<<<<<<<<
@@ -42386,7 +45002,7 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
(__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":244
+ /* "cdec/sa/rulefactory.pxi":244
* while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]:
* loc_plus[0] = loc_plus[0] + step
* loc_minus[0] = loc # <<<<<<<<<<<<<<
@@ -42395,7 +45011,7 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
*/
(__pyx_v_loc_minus[0]) = __pyx_v_loc;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":245
+ /* "cdec/sa/rulefactory.pxi":245
* loc_plus[0] = loc_plus[0] + step
* loc_minus[0] = loc
* while loc_minus[0]-step >= low and arr[loc_minus[0]-step] == arr[loc]: # <<<<<<<<<<<<<<
@@ -42403,16 +45019,20 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
*
*/
while (1) {
- __pyx_t_3 = ((((__pyx_v_loc_minus[0]) - __pyx_v_step) >= __pyx_v_low) != 0);
- if (__pyx_t_3) {
- __pyx_t_1 = (((__pyx_v_arr[((__pyx_v_loc_minus[0]) - __pyx_v_step)]) == (__pyx_v_arr[__pyx_v_loc])) != 0);
- __pyx_t_2 = __pyx_t_1;
+ __pyx_t_2 = ((((__pyx_v_loc_minus[0]) - __pyx_v_step) >= __pyx_v_low) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L10_next_and;
} else {
- __pyx_t_2 = __pyx_t_3;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L9_bool_binop_done;
}
- if (!__pyx_t_2) break;
+ __pyx_L10_next_and:;
+ __pyx_t_2 = (((__pyx_v_arr[((__pyx_v_loc_minus[0]) - __pyx_v_step)]) == (__pyx_v_arr[__pyx_v_loc])) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L9_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":246
+ /* "cdec/sa/rulefactory.pxi":246
* loc_minus[0] = loc
* while loc_minus[0]-step >= low and arr[loc_minus[0]-step] == arr[loc]:
* loc_minus[0] = loc_minus[0] - step # <<<<<<<<<<<<<<
@@ -42422,7 +45042,7 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
(__pyx_v_loc_minus[0]) = ((__pyx_v_loc_minus[0]) - __pyx_v_step);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":237
+ /* "cdec/sa/rulefactory.pxi":237
*
*
* cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<<
@@ -42434,7 +45054,7 @@ static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, in
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":303
+/* "cdec/sa/rulefactory.pxi":303
* cdef bilex
*
* def __cinit__(self, # <<<<<<<<<<<<<<
@@ -42477,7 +45097,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_alignment,&__pyx_n_s_bilex,&__pyx_n_s_by_slack_factor,&__pyx_n_s_category,&__pyx_n_s_max_chunks,&__pyx_n_s_max_initial_size,&__pyx_n_s_max_length,&__pyx_n_s_max_nonterminals,&__pyx_n_s_max_target_chunks,&__pyx_n_s_max_target_length,&__pyx_n_s_min_gap_size,&__pyx_n_s_precompute_file,&__pyx_n_s_precompute_secondary_rank,&__pyx_n_s_precompute_rank,&__pyx_n_s_require_aligned_terminal,&__pyx_n_s_require_aligned_chunks,&__pyx_n_s_train_max_initial_size,&__pyx_n_s_train_min_gap_size,&__pyx_n_s_tight_phrases,&__pyx_n_s_use_baeza_yates,&__pyx_n_s_use_collocations,&__pyx_n_s_use_index,0};
PyObject* values[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":307
+ /* "cdec/sa/rulefactory.pxi":307
* Alignment alignment,
* # bilexical dictionary if online
* bilex=None, # <<<<<<<<<<<<<<
@@ -42486,7 +45106,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
*/
values[1] = ((PyObject *)Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":313
+ /* "cdec/sa/rulefactory.pxi":313
* char* category="[X]",
* # maximum number of contiguous chunks of terminal symbols in RHS of a rule. If None, defaults to max_nonterminals+1
* max_chunks=None, # <<<<<<<<<<<<<<
@@ -42495,7 +45115,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
*/
values[4] = ((PyObject *)Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":321
+ /* "cdec/sa/rulefactory.pxi":321
* unsigned max_nonterminals=2,
* # maximum number of contiguous chunks of terminal symbols in target-side RHS of a rule. If None, defaults to max_nonterminals+1
* max_target_chunks=None, # <<<<<<<<<<<<<<
@@ -42504,7 +45124,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
*/
values[8] = ((PyObject *)Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":323
+ /* "cdec/sa/rulefactory.pxi":323
* max_target_chunks=None,
* # maximum number of target side symbols (both T and NT) allowed in a rule. If None, defaults to max_initial_size
* max_target_length=None, # <<<<<<<<<<<<<<
@@ -42513,7 +45133,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
*/
values[9] = ((PyObject *)Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":327
+ /* "cdec/sa/rulefactory.pxi":327
* unsigned min_gap_size=2,
* # filename of file containing precomputed collocations
* precompute_file=None, # <<<<<<<<<<<<<<
@@ -42742,7 +45362,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":333
+ /* "cdec/sa/rulefactory.pxi":333
* unsigned precompute_rank=100,
* # require extracted rules to have at least one aligned word
* bint require_aligned_terminal=True, # <<<<<<<<<<<<<<
@@ -42755,7 +45375,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[15]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":335
+ /* "cdec/sa/rulefactory.pxi":335
* bint require_aligned_terminal=True,
* # require each contiguous chunk of extracted rules to have at least one aligned word
* bint require_aligned_chunks=False, # <<<<<<<<<<<<<<
@@ -42778,7 +45398,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":341
+ /* "cdec/sa/rulefactory.pxi":341
* unsigned train_min_gap_size=2,
* # False if phrases should be loose (better but slower), True otherwise
* bint tight_phrases=True, # <<<<<<<<<<<<<<
@@ -42791,7 +45411,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":343
+ /* "cdec/sa/rulefactory.pxi":343
* bint tight_phrases=True,
* # True to require use of double-binary alg, false otherwise
* bint use_baeza_yates=True, # <<<<<<<<<<<<<<
@@ -42804,7 +45424,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":345
+ /* "cdec/sa/rulefactory.pxi":345
* bint use_baeza_yates=True,
* # True to enable used of precomputed collocations
* bint use_collocations=True, # <<<<<<<<<<<<<<
@@ -42817,7 +45437,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
__pyx_v_use_index = __Pyx_PyObject_IsTrue(values[21]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":347
+ /* "cdec/sa/rulefactory.pxi":347
* bint use_collocations=True,
* # True to enable use of precomputed inverted indices
* bint use_index=True): # <<<<<<<<<<<<<<
@@ -42838,7 +45458,7 @@ static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignment), __pyx_ptype_4cdec_2sa_3_sa_Alignment, 1, "alignment", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_alignment, __pyx_v_bilex, __pyx_v_by_slack_factor, __pyx_v_category, __pyx_v_max_chunks, __pyx_v_max_initial_size, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_max_target_chunks, __pyx_v_max_target_length, __pyx_v_min_gap_size, __pyx_v_precompute_file, __pyx_v_precompute_secondary_rank, __pyx_v_precompute_rank, __pyx_v_require_aligned_terminal, __pyx_v_require_aligned_chunks, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size, __pyx_v_tight_phrases, __pyx_v_use_baeza_yates, __pyx_v_use_collocations, __pyx_v_use_index);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":303
+ /* "cdec/sa/rulefactory.pxi":303
* cdef bilex
*
* def __cinit__(self, # <<<<<<<<<<<<<<
@@ -42864,12 +45484,13 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
int __pyx_t_4;
int __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":353
+ /* "cdec/sa/rulefactory.pxi":353
* respectively. This is because Chiang's model does not require
* them to be the same, therefore we don't either.'''
* self.rules = TrieTable(True) # cache # <<<<<<<<<<<<<<
@@ -42884,7 +45505,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":354
+ /* "cdec/sa/rulefactory.pxi":354
* them to be the same, therefore we don't either.'''
* self.rules = TrieTable(True) # cache
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<<
@@ -42906,7 +45527,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->rules->root = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":355
+ /* "cdec/sa/rulefactory.pxi":355
* self.rules = TrieTable(True) # cache
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation())
* if alignment is None: # <<<<<<<<<<<<<<
@@ -42917,7 +45538,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_4 = (__pyx_t_3 != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":356
+ /* "cdec/sa/rulefactory.pxi":356
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation())
* if alignment is None:
* raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<<
@@ -42931,7 +45552,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357
+ /* "cdec/sa/rulefactory.pxi":357
* if alignment is None:
* raise Exception("Must specify an alignment object")
* self.alignment = alignment # <<<<<<<<<<<<<<
@@ -42944,7 +45565,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__Pyx_DECREF(((PyObject *)__pyx_v_self->alignment));
__pyx_v_self->alignment = __pyx_v_alignment;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":361
+ /* "cdec/sa/rulefactory.pxi":361
* # grammar parameters and settings
* # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero
* self.max_length = max_length # <<<<<<<<<<<<<<
@@ -42953,7 +45574,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->max_length = __pyx_v_max_length;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":362
+ /* "cdec/sa/rulefactory.pxi":362
* # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero
* self.max_length = max_length
* self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<<
@@ -42962,7 +45583,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":363
+ /* "cdec/sa/rulefactory.pxi":363
* self.max_length = max_length
* self.max_nonterminals = max_nonterminals
* self.max_initial_size = max_initial_size # <<<<<<<<<<<<<<
@@ -42971,7 +45592,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->max_initial_size = __pyx_v_max_initial_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":364
+ /* "cdec/sa/rulefactory.pxi":364
* self.max_nonterminals = max_nonterminals
* self.max_initial_size = max_initial_size
* self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<<
@@ -42980,7 +45601,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":365
+ /* "cdec/sa/rulefactory.pxi":365
* self.max_initial_size = max_initial_size
* self.train_max_initial_size = train_max_initial_size
* self.min_gap_size = min_gap_size # <<<<<<<<<<<<<<
@@ -42989,7 +45610,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->min_gap_size = __pyx_v_min_gap_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":366
+ /* "cdec/sa/rulefactory.pxi":366
* self.train_max_initial_size = train_max_initial_size
* self.min_gap_size = min_gap_size
* self.train_min_gap_size = train_min_gap_size # <<<<<<<<<<<<<<
@@ -42998,7 +45619,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->train_min_gap_size = __pyx_v_train_min_gap_size;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":367
+ /* "cdec/sa/rulefactory.pxi":367
* self.min_gap_size = min_gap_size
* self.train_min_gap_size = train_min_gap_size
* self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<<
@@ -43007,7 +45628,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->category = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_v_category, 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":369
+ /* "cdec/sa/rulefactory.pxi":369
* self.category = sym_fromstring(category, False)
*
* if max_chunks is None: # <<<<<<<<<<<<<<
@@ -43018,7 +45639,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_3 = (__pyx_t_4 != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":370
+ /* "cdec/sa/rulefactory.pxi":370
*
* if max_chunks is None:
* self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<<
@@ -43030,7 +45651,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":372
+ /* "cdec/sa/rulefactory.pxi":372
* self.max_chunks = self.max_nonterminals + 1
* else:
* self.max_chunks = max_chunks # <<<<<<<<<<<<<<
@@ -43042,7 +45663,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":374
+ /* "cdec/sa/rulefactory.pxi":374
* self.max_chunks = max_chunks
*
* if max_target_chunks is None: # <<<<<<<<<<<<<<
@@ -43053,7 +45674,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_4 = (__pyx_t_3 != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":375
+ /* "cdec/sa/rulefactory.pxi":375
*
* if max_target_chunks is None:
* self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<<
@@ -43065,7 +45686,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":377
+ /* "cdec/sa/rulefactory.pxi":377
* self.max_target_chunks = self.max_nonterminals + 1
* else:
* self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<<
@@ -43077,7 +45698,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":379
+ /* "cdec/sa/rulefactory.pxi":379
* self.max_target_chunks = max_target_chunks
*
* if max_target_length is None: # <<<<<<<<<<<<<<
@@ -43088,7 +45709,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_3 = (__pyx_t_4 != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":380
+ /* "cdec/sa/rulefactory.pxi":380
*
* if max_target_length is None:
* self.max_target_length = max_initial_size # <<<<<<<<<<<<<<
@@ -43100,7 +45721,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":382
+ /* "cdec/sa/rulefactory.pxi":382
* self.max_target_length = max_initial_size
* else:
* self.max_target_length = max_target_length # <<<<<<<<<<<<<<
@@ -43112,7 +45733,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":385
+ /* "cdec/sa/rulefactory.pxi":385
*
* # algorithmic parameters and settings
* self.precomputed_collocations = {} # <<<<<<<<<<<<<<
@@ -43127,7 +45748,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->precomputed_collocations = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":386
+ /* "cdec/sa/rulefactory.pxi":386
* # algorithmic parameters and settings
* self.precomputed_collocations = {}
* self.precomputed_index = {} # <<<<<<<<<<<<<<
@@ -43142,7 +45763,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->precomputed_index = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":387
+ /* "cdec/sa/rulefactory.pxi":387
* self.precomputed_collocations = {}
* self.precomputed_index = {}
* self.use_index = use_index # <<<<<<<<<<<<<<
@@ -43151,7 +45772,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->use_index = __pyx_v_use_index;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":388
+ /* "cdec/sa/rulefactory.pxi":388
* self.precomputed_index = {}
* self.use_index = use_index
* self.use_collocations = use_collocations # <<<<<<<<<<<<<<
@@ -43160,7 +45781,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->use_collocations = __pyx_v_use_collocations;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":389
+ /* "cdec/sa/rulefactory.pxi":389
* self.use_index = use_index
* self.use_collocations = use_collocations
* self.max_rank = {} # <<<<<<<<<<<<<<
@@ -43175,7 +45796,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->max_rank = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":390
+ /* "cdec/sa/rulefactory.pxi":390
* self.use_collocations = use_collocations
* self.max_rank = {}
* self.precompute_file = precompute_file # <<<<<<<<<<<<<<
@@ -43188,7 +45809,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__Pyx_DECREF(__pyx_v_self->precompute_file);
__pyx_v_self->precompute_file = __pyx_v_precompute_file;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":391
+ /* "cdec/sa/rulefactory.pxi":391
* self.max_rank = {}
* self.precompute_file = precompute_file
* self.precompute_rank = precompute_rank # <<<<<<<<<<<<<<
@@ -43197,7 +45818,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->precompute_rank = __pyx_v_precompute_rank;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":392
+ /* "cdec/sa/rulefactory.pxi":392
* self.precompute_file = precompute_file
* self.precompute_rank = precompute_rank
* self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<<
@@ -43206,7 +45827,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":393
+ /* "cdec/sa/rulefactory.pxi":393
* self.precompute_rank = precompute_rank
* self.precompute_secondary_rank = precompute_secondary_rank
* self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<<
@@ -43215,7 +45836,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":394
+ /* "cdec/sa/rulefactory.pxi":394
* self.precompute_secondary_rank = precompute_secondary_rank
* self.use_baeza_yates = use_baeza_yates
* self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<<
@@ -43224,7 +45845,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":395
+ /* "cdec/sa/rulefactory.pxi":395
* self.use_baeza_yates = use_baeza_yates
* self.by_slack_factor = by_slack_factor
* self.tight_phrases = tight_phrases # <<<<<<<<<<<<<<
@@ -43233,7 +45854,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->tight_phrases = __pyx_v_tight_phrases;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":397
+ /* "cdec/sa/rulefactory.pxi":397
* self.tight_phrases = tight_phrases
*
* if require_aligned_chunks: # <<<<<<<<<<<<<<
@@ -43243,7 +45864,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_3 = (__pyx_v_require_aligned_chunks != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":399
+ /* "cdec/sa/rulefactory.pxi":399
* if require_aligned_chunks:
* # one condition is a stronger version of the other.
* self.require_aligned_chunks = self.require_aligned_terminal = True # <<<<<<<<<<<<<<
@@ -43255,7 +45876,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
goto __pyx_L7;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":400
+ /* "cdec/sa/rulefactory.pxi":400
* # one condition is a stronger version of the other.
* self.require_aligned_chunks = self.require_aligned_terminal = True
* elif require_aligned_terminal: # <<<<<<<<<<<<<<
@@ -43265,7 +45886,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_t_3 = (__pyx_v_require_aligned_terminal != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":401
+ /* "cdec/sa/rulefactory.pxi":401
* self.require_aligned_chunks = self.require_aligned_terminal = True
* elif require_aligned_terminal:
* self.require_aligned_chunks = False # <<<<<<<<<<<<<<
@@ -43274,7 +45895,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->require_aligned_chunks = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":402
+ /* "cdec/sa/rulefactory.pxi":402
* elif require_aligned_terminal:
* self.require_aligned_chunks = False
* self.require_aligned_terminal = True # <<<<<<<<<<<<<<
@@ -43286,7 +45907,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":404
+ /* "cdec/sa/rulefactory.pxi":404
* self.require_aligned_terminal = True
* else:
* self.require_aligned_chunks = self.require_aligned_terminal = False # <<<<<<<<<<<<<<
@@ -43298,7 +45919,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
}
__pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":407
+ /* "cdec/sa/rulefactory.pxi":407
*
* # diagnostics
* self.prev_norm_prefix = () # <<<<<<<<<<<<<<
@@ -43311,7 +45932,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__Pyx_DECREF(__pyx_v_self->prev_norm_prefix);
__pyx_v_self->prev_norm_prefix = __pyx_empty_tuple;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":409
+ /* "cdec/sa/rulefactory.pxi":409
* self.prev_norm_prefix = ()
*
* self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<<
@@ -43330,7 +45951,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":410
+ /* "cdec/sa/rulefactory.pxi":410
*
* self.findexes = IntList(initial_len=10)
* self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<<
@@ -43349,7 +45970,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__pyx_v_self->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":416
+ /* "cdec/sa/rulefactory.pxi":416
* # None if not online
* # Base bilex, also need one per instance
* self.bilex = bilex # <<<<<<<<<<<<<<
@@ -43362,7 +45983,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__Pyx_DECREF(__pyx_v_self->bilex);
__pyx_v_self->bilex = __pyx_v_bilex;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":419
+ /* "cdec/sa/rulefactory.pxi":419
*
* # True after data is added
* self.online = False # <<<<<<<<<<<<<<
@@ -43371,31 +45992,47 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
*/
__pyx_v_self->online = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":420
+ /* "cdec/sa/rulefactory.pxi":420
* # True after data is added
* self.online = False
* self.online_stats = defaultdict(OnlineStats) # <<<<<<<<<<<<<<
*
* def configure(self, SuffixArray fsarray, DataArray edarray,
*/
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_OnlineStats)));
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_GIVEREF(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_v_self->online_stats);
__Pyx_DECREF(__pyx_v_self->online_stats);
- __pyx_v_self->online_stats = __pyx_t_6;
- __pyx_t_6 = 0;
+ __pyx_v_self->online_stats = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":303
+ /* "cdec/sa/rulefactory.pxi":303
* cdef bilex
*
* def __cinit__(self, # <<<<<<<<<<<<<<
@@ -43410,6 +46047,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -43417,7 +46055,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":422
+/* "cdec/sa/rulefactory.pxi":422
* self.online_stats = defaultdict(OnlineStats)
*
* def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<<
@@ -43518,12 +46156,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("configure", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":427
+ /* "cdec/sa/rulefactory.pxi":427
* Here we also use it to precompute the most expensive intersections
* in the corpus quickly.'''
* self.fsa = fsarray # <<<<<<<<<<<<<<
@@ -43536,7 +46175,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__Pyx_DECREF(((PyObject *)__pyx_v_self->fsa));
__pyx_v_self->fsa = __pyx_v_fsarray;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":428
+ /* "cdec/sa/rulefactory.pxi":428
* in the corpus quickly.'''
* self.fsa = fsarray
* self.fda = fsarray.darray # <<<<<<<<<<<<<<
@@ -43551,7 +46190,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__pyx_v_self->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":429
+ /* "cdec/sa/rulefactory.pxi":429
* self.fsa = fsarray
* self.fda = fsarray.darray
* self.eda = edarray # <<<<<<<<<<<<<<
@@ -43564,7 +46203,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__Pyx_DECREF(((PyObject *)__pyx_v_self->eda));
__pyx_v_self->eda = __pyx_v_edarray;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":430
+ /* "cdec/sa/rulefactory.pxi":430
* self.fda = fsarray.darray
* self.eda = edarray
* self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<<
@@ -43583,7 +46222,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__pyx_v_self->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":431
+ /* "cdec/sa/rulefactory.pxi":431
* self.eda = edarray
* self.fid2symid = self.set_idmap(self.fda)
* self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<<
@@ -43602,21 +46241,36 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__pyx_v_self->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":432
+ /* "cdec/sa/rulefactory.pxi":432
* self.fid2symid = self.set_idmap(self.fda)
* self.eid2symid = self.set_idmap(self.eda)
* self.precompute() # <<<<<<<<<<<<<<
* self.sampler = sampler
* self.scorer = scorer
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_precompute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_precompute); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":433
+ /* "cdec/sa/rulefactory.pxi":433
* self.eid2symid = self.set_idmap(self.eda)
* self.precompute()
* self.sampler = sampler # <<<<<<<<<<<<<<
@@ -43629,7 +46283,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__Pyx_DECREF(((PyObject *)__pyx_v_self->sampler));
__pyx_v_self->sampler = __pyx_v_sampler;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":434
+ /* "cdec/sa/rulefactory.pxi":434
* self.precompute()
* self.sampler = sampler
* self.scorer = scorer # <<<<<<<<<<<<<<
@@ -43642,7 +46296,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__Pyx_DECREF(((PyObject *)__pyx_v_self->scorer));
__pyx_v_self->scorer = __pyx_v_scorer;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":422
+ /* "cdec/sa/rulefactory.pxi":422
* self.online_stats = defaultdict(OnlineStats)
*
* def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<<
@@ -43656,6 +46310,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -43664,7 +46319,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(st
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":436
+/* "cdec/sa/rulefactory.pxi":436
* self.scorer = scorer
*
* cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<<
@@ -43689,7 +46344,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set_idmap", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":440
+ /* "cdec/sa/rulefactory.pxi":440
* cdef IntList idmap
*
* N = len(darray.id2word) # <<<<<<<<<<<<<<
@@ -43702,7 +46357,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_N = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":441
+ /* "cdec/sa/rulefactory.pxi":441
*
* N = len(darray.id2word)
* idmap = IntList(initial_len=N) # <<<<<<<<<<<<<<
@@ -43721,7 +46376,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
__pyx_v_idmap = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":442
+ /* "cdec/sa/rulefactory.pxi":442
* N = len(darray.id2word)
* idmap = IntList(initial_len=N)
* for word_id from 0 <= word_id < N: # <<<<<<<<<<<<<<
@@ -43731,7 +46386,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
__pyx_t_4 = __pyx_v_N;
for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":443
+ /* "cdec/sa/rulefactory.pxi":443
* idmap = IntList(initial_len=N)
* for word_id from 0 <= word_id < N:
* new_word_id = sym_fromstring(darray.id2word[word_id], True) # <<<<<<<<<<<<<<
@@ -43741,10 +46396,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_new_word_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":444
+ /* "cdec/sa/rulefactory.pxi":444
* for word_id from 0 <= word_id < N:
* new_word_id = sym_fromstring(darray.id2word[word_id], True)
* idmap.arr[word_id] = new_word_id # <<<<<<<<<<<<<<
@@ -43754,7 +46409,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
(__pyx_v_idmap->arr[__pyx_v_word_id]) = __pyx_v_new_word_id;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":445
+ /* "cdec/sa/rulefactory.pxi":445
* new_word_id = sym_fromstring(darray.id2word[word_id], True)
* idmap.arr[word_id] = new_word_id
* return idmap # <<<<<<<<<<<<<<
@@ -43766,7 +46421,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
__pyx_r = ((PyObject *)__pyx_v_idmap);
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":436
+ /* "cdec/sa/rulefactory.pxi":436
* self.scorer = scorer
*
* cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<<
@@ -43787,7 +46442,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap(CYTH
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":448
+/* "cdec/sa/rulefactory.pxi":448
*
*
* def pattern2phrase(self, pattern): # <<<<<<<<<<<<<<
@@ -43828,7 +46483,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("pattern2phrase", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":450
+ /* "cdec/sa/rulefactory.pxi":450
* def pattern2phrase(self, pattern):
* # pattern is a tuple, which we must convert to a hiero Phrase
* result = () # <<<<<<<<<<<<<<
@@ -43838,7 +46493,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_INCREF(__pyx_empty_tuple);
__pyx_v_result = __pyx_empty_tuple;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":451
+ /* "cdec/sa/rulefactory.pxi":451
* # pattern is a tuple, which we must convert to a hiero Phrase
* result = ()
* arity = 0 # <<<<<<<<<<<<<<
@@ -43848,36 +46503,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_INCREF(__pyx_int_0);
__pyx_v_arity = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":452
+ /* "cdec/sa/rulefactory.pxi":452
* result = ()
* arity = 0
* for word_id in pattern: # <<<<<<<<<<<<<<
* if word_id == -1:
* arity = arity + 1
*/
- if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
+ if (likely(PyList_CheckExact(__pyx_v_pattern)) || PyTuple_CheckExact(__pyx_v_pattern)) {
__pyx_t_1 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -43893,7 +46550,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":453
+ /* "cdec/sa/rulefactory.pxi":453
* arity = 0
* for word_id in pattern:
* if word_id == -1: # <<<<<<<<<<<<<<
@@ -43905,7 +46562,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":454
+ /* "cdec/sa/rulefactory.pxi":454
* for word_id in pattern:
* if word_id == -1:
* arity = arity + 1 # <<<<<<<<<<<<<<
@@ -43917,7 +46574,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":455
+ /* "cdec/sa/rulefactory.pxi":455
* if word_id == -1:
* arity = arity + 1
* new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<<
@@ -43930,7 +46587,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":457
+ /* "cdec/sa/rulefactory.pxi":457
* new_id = sym_setindex(self.category, arity)
* else:
* new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<<
@@ -43940,12 +46597,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_7, 1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":458
+ /* "cdec/sa/rulefactory.pxi":458
* else:
* new_id = sym_fromstring(self.fda.id2word[word_id], True)
* result = result + (new_id,) # <<<<<<<<<<<<<<
@@ -43964,10 +46621,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":452
+ * result = ()
+ * arity = 0
+ * for word_id in pattern: # <<<<<<<<<<<<<<
+ * if word_id == -1:
+ * arity = arity + 1
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":459
+ /* "cdec/sa/rulefactory.pxi":459
* new_id = sym_fromstring(self.fda.id2word[word_id], True)
* result = result + (new_id,)
* return Phrase(result) # <<<<<<<<<<<<<<
@@ -43987,7 +46652,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
__pyx_t_4 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":448
+ /* "cdec/sa/rulefactory.pxi":448
*
*
* def pattern2phrase(self, pattern): # <<<<<<<<<<<<<<
@@ -44011,7 +46676,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phra
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":461
+/* "cdec/sa/rulefactory.pxi":461
* return Phrase(result)
*
* def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<<
@@ -44054,7 +46719,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("pattern2phrase_plus", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":464
+ /* "cdec/sa/rulefactory.pxi":464
* # returns a list containing both the pattern, and pattern
* # suffixed/prefixed with the NT category.
* patterns = [] # <<<<<<<<<<<<<<
@@ -44066,7 +46731,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_v_patterns = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":465
+ /* "cdec/sa/rulefactory.pxi":465
* # suffixed/prefixed with the NT category.
* patterns = []
* result = () # <<<<<<<<<<<<<<
@@ -44076,7 +46741,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_INCREF(__pyx_empty_tuple);
__pyx_v_result = __pyx_empty_tuple;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":466
+ /* "cdec/sa/rulefactory.pxi":466
* patterns = []
* result = ()
* arity = 0 # <<<<<<<<<<<<<<
@@ -44086,36 +46751,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_INCREF(__pyx_int_0);
__pyx_v_arity = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":467
+ /* "cdec/sa/rulefactory.pxi":467
* result = ()
* arity = 0
* for word_id in pattern: # <<<<<<<<<<<<<<
* if word_id == -1:
* arity = arity + 1
*/
- if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
+ if (likely(PyList_CheckExact(__pyx_v_pattern)) || PyTuple_CheckExact(__pyx_v_pattern)) {
__pyx_t_1 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -44131,7 +46798,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_XDECREF_SET(__pyx_v_word_id, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":468
+ /* "cdec/sa/rulefactory.pxi":468
* arity = 0
* for word_id in pattern:
* if word_id == -1: # <<<<<<<<<<<<<<
@@ -44143,7 +46810,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":469
+ /* "cdec/sa/rulefactory.pxi":469
* for word_id in pattern:
* if word_id == -1:
* arity = arity + 1 # <<<<<<<<<<<<<<
@@ -44155,7 +46822,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_DECREF_SET(__pyx_v_arity, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":470
+ /* "cdec/sa/rulefactory.pxi":470
* if word_id == -1:
* arity = arity + 1
* new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<<
@@ -44168,7 +46835,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":472
+ /* "cdec/sa/rulefactory.pxi":472
* new_id = sym_setindex(self.category, arity)
* else:
* new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<<
@@ -44178,12 +46845,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_7, 1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":473
+ /* "cdec/sa/rulefactory.pxi":473
* else:
* new_id = sym_fromstring(self.fda.id2word[word_id], True)
* result = result + (new_id,) # <<<<<<<<<<<<<<
@@ -44202,10 +46869,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_4));
__pyx_t_4 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":467
+ * result = ()
+ * arity = 0
+ * for word_id in pattern: # <<<<<<<<<<<<<<
+ * if word_id == -1:
+ * arity = arity + 1
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":474
+ /* "cdec/sa/rulefactory.pxi":474
* new_id = sym_fromstring(self.fda.id2word[word_id], True)
* result = result + (new_id,)
* patterns.append(Phrase(result)) # <<<<<<<<<<<<<<
@@ -44223,7 +46898,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_t_9 = __Pyx_PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":475
+ /* "cdec/sa/rulefactory.pxi":475
* result = result + (new_id,)
* patterns.append(Phrase(result))
* patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) # <<<<<<<<<<<<<<
@@ -44251,7 +46926,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_t_9 = __Pyx_PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":476
+ /* "cdec/sa/rulefactory.pxi":476
* patterns.append(Phrase(result))
* patterns.append(Phrase(result + (sym_setindex(self.category, 1),)))
* patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) # <<<<<<<<<<<<<<
@@ -44279,7 +46954,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_t_9 = __Pyx_PyList_Append(__pyx_v_patterns, __pyx_t_4); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":477
+ /* "cdec/sa/rulefactory.pxi":477
* patterns.append(Phrase(result + (sym_setindex(self.category, 1),)))
* patterns.append(Phrase((sym_setindex(self.category, 1),) + result))
* return patterns # <<<<<<<<<<<<<<
@@ -44291,7 +46966,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
__pyx_r = __pyx_v_patterns;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":461
+ /* "cdec/sa/rulefactory.pxi":461
* return Phrase(result)
*
* def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<<
@@ -44316,7 +46991,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phra
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":479
+/* "cdec/sa/rulefactory.pxi":479
* return patterns
*
* def precompute(self): # <<<<<<<<<<<<<<
@@ -44352,19 +47027,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- Py_ssize_t __pyx_t_7;
- Py_ssize_t __pyx_t_8;
- int __pyx_t_9;
- int __pyx_t_10;
- Py_ssize_t __pyx_t_11;
- PyObject *(*__pyx_t_12)(PyObject *);
+ Py_ssize_t __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ Py_ssize_t __pyx_t_10;
+ int __pyx_t_11;
+ int __pyx_t_12;
+ Py_ssize_t __pyx_t_13;
+ PyObject *(*__pyx_t_14)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("precompute", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":482
+ /* "cdec/sa/rulefactory.pxi":482
* cdef Precomputation pre
*
* if self.precompute_file is not None: # <<<<<<<<<<<<<<
@@ -44375,22 +47052,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":483
+ /* "cdec/sa/rulefactory.pxi":483
*
* if self.precompute_file is not None:
* start_time = monitor_cpu() # <<<<<<<<<<<<<<
* logger.info("Reading precomputed data from file %s... ", self.precompute_file)
* pre = Precomputation(from_binary=self.precompute_file)
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_v_start_time = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_5) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_start_time = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":484
+ /* "cdec/sa/rulefactory.pxi":484
* if self.precompute_file is not None:
* start_time = monitor_cpu()
* logger.info("Reading precomputed data from file %s... ", self.precompute_file) # <<<<<<<<<<<<<<
@@ -44399,40 +47091,55 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
*/
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Reading_precomputed_data_from_fi);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Reading_precomputed_data_from_fi);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Reading_precomputed_data_from_fi);
__Pyx_GIVEREF(__pyx_kp_s_Reading_precomputed_data_from_fi);
__Pyx_INCREF(__pyx_v_self->precompute_file);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->precompute_file);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self->precompute_file);
__Pyx_GIVEREF(__pyx_v_self->precompute_file);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":485
+ /* "cdec/sa/rulefactory.pxi":485
* start_time = monitor_cpu()
* logger.info("Reading precomputed data from file %s... ", self.precompute_file)
* pre = Precomputation(from_binary=self.precompute_file) # <<<<<<<<<<<<<<
* # check parameters of precomputation -- some are critical and some are not
* if pre.max_nonterminals != self.max_nonterminals:
*/
- __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_from_binary, __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Precomputation)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_from_binary, __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Precomputation)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_v_pre = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_t_4);
- __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_pre = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":487
+ /* "cdec/sa/rulefactory.pxi":487
* pre = Precomputation(from_binary=self.precompute_file)
* # check parameters of precomputation -- some are critical and some are not
* if pre.max_nonterminals != self.max_nonterminals: # <<<<<<<<<<<<<<
@@ -44442,43 +47149,58 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = ((__pyx_v_pre->max_nonterminals != __pyx_v_self->max_nonterminals) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":488
+ /* "cdec/sa/rulefactory.pxi":488
* # check parameters of precomputation -- some are critical and some are not
* if pre.max_nonterminals != self.max_nonterminals:
* logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) # <<<<<<<<<<<<<<
* if pre.max_length != self.max_length:
* logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length)
*/
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pre->max_nonterminals); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pre->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Precomputation_done_with_max_non);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_Precomputation_done_with_max_non);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_6, __pyx_kp_s_Precomputation_done_with_max_non);
__Pyx_GIVEREF(__pyx_kp_s_Precomputation_done_with_max_non);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_6, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_4 = 0;
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_6, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L4;
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":489
+ /* "cdec/sa/rulefactory.pxi":489
* if pre.max_nonterminals != self.max_nonterminals:
* logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals)
* if pre.max_length != self.max_length: # <<<<<<<<<<<<<<
@@ -44488,43 +47210,58 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = ((__pyx_v_pre->max_length != __pyx_v_self->max_length) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":490
+ /* "cdec/sa/rulefactory.pxi":490
* logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals)
* if pre.max_length != self.max_length:
* logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length) # <<<<<<<<<<<<<<
* if pre.train_max_initial_size != self.train_max_initial_size:
* raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size))
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_warn); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Precomputation_done_with_max_ter);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Precomputation_done_with_max_ter);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_kp_s_Precomputation_done_with_max_ter);
__Pyx_GIVEREF(__pyx_kp_s_Precomputation_done_with_max_ter);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_3 = 0;
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_7 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":491
+ /* "cdec/sa/rulefactory.pxi":491
* if pre.max_length != self.max_length:
* logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length)
* if pre.train_max_initial_size != self.train_max_initial_size: # <<<<<<<<<<<<<<
@@ -44534,7 +47271,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = ((__pyx_v_pre->train_max_initial_size != __pyx_v_self->train_max_initial_size) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":492
+ /* "cdec/sa/rulefactory.pxi":492
* logger.warn("Precomputation done with max terminals %d, decoder uses %d", pre.max_length, self.max_length)
* if pre.train_max_initial_size != self.train_max_initial_size:
* raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size)) # <<<<<<<<<<<<<<
@@ -44543,33 +47280,33 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
*/
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
+ __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
__pyx_t_5 = 0;
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Precomputation_done_with_max_ini, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Precomputation_done_with_max_ini, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_Raise(__pyx_t_9, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":493
+ /* "cdec/sa/rulefactory.pxi":493
* if pre.train_max_initial_size != self.train_max_initial_size:
* raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size))
* if pre.train_min_gap_size != self.train_min_gap_size: # <<<<<<<<<<<<<<
@@ -44579,42 +47316,42 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = ((__pyx_v_pre->train_min_gap_size != __pyx_v_self->train_min_gap_size) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":494
+ /* "cdec/sa/rulefactory.pxi":494
* raise Exception("Precomputation done with max initial size %d, decoder uses %d" % (pre.train_max_initial_size, self.train_max_initial_size))
* if pre.train_min_gap_size != self.train_min_gap_size:
* raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size)) # <<<<<<<<<<<<<<
* if self.use_index:
* logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index))
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_4 = 0;
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Precomputation_done_with_min_gap, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_9 = 0;
+ __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Precomputation_done_with_min_gap, __pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_Raise(__pyx_t_6, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":495
+ /* "cdec/sa/rulefactory.pxi":495
* if pre.train_min_gap_size != self.train_min_gap_size:
* raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size))
* if self.use_index: # <<<<<<<<<<<<<<
@@ -44624,120 +47361,153 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = (__pyx_v_self->use_index != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":496
+ /* "cdec/sa/rulefactory.pxi":496
* raise Exception("Precomputation done with min gap size %d, decoder uses %d" % (pre.train_min_gap_size, self.train_min_gap_size))
* if self.use_index:
* logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index)) # <<<<<<<<<<<<<<
* for pattern, arr in pre.precomputed_index.iteritems():
* phrases = self.pattern2phrase_plus(pattern)
*/
- __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __pyx_v_pre->precomputed_index;
- __Pyx_INCREF(__pyx_t_6);
- __pyx_t_7 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_v_pre->precomputed_index;
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Converting_d_hash_keys_on_precom);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Converting_d_hash_keys_on_precom);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Converting_d_hash_keys_on_precom);
__Pyx_GIVEREF(__pyx_kp_s_Converting_d_hash_keys_on_precom);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":497
+ /* "cdec/sa/rulefactory.pxi":497
* if self.use_index:
* logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index))
* for pattern, arr in pre.precomputed_index.iteritems(): # <<<<<<<<<<<<<<
* phrases = self.pattern2phrase_plus(pattern)
* for phrase in phrases:
*/
- __pyx_t_7 = 0;
+ __pyx_t_6 = 0;
if (unlikely(__pyx_v_pre->precomputed_index == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, __pyx_n_s_iteritems, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_6);
- __pyx_t_6 = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, __pyx_n_s_iteritems, (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_8);
+ __pyx_t_8 = __pyx_t_9;
+ __pyx_t_9 = 0;
while (1) {
- __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_8, &__pyx_t_7, &__pyx_t_4, &__pyx_t_5, NULL, __pyx_t_9);
- if (unlikely(__pyx_t_10 == 0)) break;
- if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
- __pyx_t_4 = 0;
- __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_8, __pyx_t_10, &__pyx_t_6, &__pyx_t_9, &__pyx_t_7, NULL, __pyx_t_11);
+ if (unlikely(__pyx_t_12 == 0)) break;
+ if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_9);
+ __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_7);
+ __pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":498
+ /* "cdec/sa/rulefactory.pxi":498
* logger.info("Converting %d hash keys on precomputed inverted index... ", len(pre.precomputed_index))
* for pattern, arr in pre.precomputed_index.iteritems():
* phrases = self.pattern2phrase_plus(pattern) # <<<<<<<<<<<<<<
* for phrase in phrases:
* self.precomputed_index[phrase] = arr
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pattern2phrase_plus); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_pattern);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pattern);
- __Pyx_GIVEREF(__pyx_v_pattern);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF_SET(__pyx_v_phrases, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pattern2phrase_plus); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_5 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (!__pyx_t_5) {
+ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_pattern); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ __Pyx_INCREF(__pyx_v_pattern);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_pattern);
+ __Pyx_GIVEREF(__pyx_v_pattern);
+ __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_phrases, __pyx_t_7);
+ __pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":499
+ /* "cdec/sa/rulefactory.pxi":499
* for pattern, arr in pre.precomputed_index.iteritems():
* phrases = self.pattern2phrase_plus(pattern)
* for phrase in phrases: # <<<<<<<<<<<<<<
* self.precomputed_index[phrase] = arr
* if self.use_collocations:
*/
- if (PyList_CheckExact(__pyx_v_phrases) || PyTuple_CheckExact(__pyx_v_phrases)) {
- __pyx_t_3 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0;
- __pyx_t_12 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_phrases)) || PyTuple_CheckExact(__pyx_v_phrases)) {
+ __pyx_t_7 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0;
+ __pyx_t_14 = NULL;
} else {
- __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_13 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_14 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_14)) {
+ if (likely(PyList_CheckExact(__pyx_t_7))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_12(__pyx_t_3);
- if (unlikely(!__pyx_t_4)) {
+ __pyx_t_9 = __pyx_t_14(__pyx_t_7);
+ if (unlikely(!__pyx_t_9)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -44745,12 +47515,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
}
break;
}
- __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_t_9);
}
- __Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_4);
- __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_9);
+ __pyx_t_9 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":500
+ /* "cdec/sa/rulefactory.pxi":500
* phrases = self.pattern2phrase_plus(pattern)
* for phrase in phrases:
* self.precomputed_index[phrase] = arr # <<<<<<<<<<<<<<
@@ -44758,15 +47528,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
* logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations))
*/
if (unlikely(PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+ /* "cdec/sa/rulefactory.pxi":499
+ * for pattern, arr in pre.precomputed_index.iteritems():
+ * phrases = self.pattern2phrase_plus(pattern)
+ * for phrase in phrases: # <<<<<<<<<<<<<<
+ * self.precomputed_index[phrase] = arr
+ * if self.use_collocations:
+ */
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L8;
}
__pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":501
+ /* "cdec/sa/rulefactory.pxi":501
* for phrase in phrases:
* self.precomputed_index[phrase] = arr
* if self.use_collocations: # <<<<<<<<<<<<<<
@@ -44776,88 +47554,119 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__pyx_t_2 = (__pyx_v_self->use_collocations != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":502
+ /* "cdec/sa/rulefactory.pxi":502
* self.precomputed_index[phrase] = arr
* if self.use_collocations:
* logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) # <<<<<<<<<<<<<<
* for pattern, arr in pre.precomputed_collocations.iteritems():
* phrase = self.pattern2phrase(pattern)
*/
- __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __pyx_v_pre->precomputed_collocations;
- __Pyx_INCREF(__pyx_t_6);
- __pyx_t_8 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = __pyx_v_pre->precomputed_collocations;
+ __Pyx_INCREF(__pyx_t_7);
+ __pyx_t_10 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_4 = NULL;
+ __pyx_t_10 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_10 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Converting_d_hash_keys_on_precom_2);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Converting_d_hash_keys_on_precom_2);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_kp_s_Converting_d_hash_keys_on_precom_2);
__Pyx_GIVEREF(__pyx_kp_s_Converting_d_hash_keys_on_precom_2);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":503
+ /* "cdec/sa/rulefactory.pxi":503
* if self.use_collocations:
* logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations))
* for pattern, arr in pre.precomputed_collocations.iteritems(): # <<<<<<<<<<<<<<
* phrase = self.pattern2phrase(pattern)
* self.precomputed_collocations[phrase] = arr
*/
- __pyx_t_8 = 0;
+ __pyx_t_10 = 0;
if (unlikely(__pyx_v_pre->precomputed_collocations == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, __pyx_n_s_iteritems, (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_6);
- __pyx_t_6 = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_9 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, __pyx_n_s_iteritems, (&__pyx_t_6), (&__pyx_t_11)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_8);
+ __pyx_t_8 = __pyx_t_9;
+ __pyx_t_9 = 0;
while (1) {
- __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_7, &__pyx_t_8, &__pyx_t_4, &__pyx_t_3, NULL, __pyx_t_9);
- if (unlikely(__pyx_t_10 == 0)) break;
- if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_4);
- __pyx_t_4 = 0;
- __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_8, __pyx_t_6, &__pyx_t_10, &__pyx_t_9, &__pyx_t_5, NULL, __pyx_t_11);
+ if (unlikely(__pyx_t_12 == 0)) break;
+ if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_pattern, __pyx_t_9);
+ __pyx_t_9 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_arr, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":504
+ /* "cdec/sa/rulefactory.pxi":504
* logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations))
* for pattern, arr in pre.precomputed_collocations.iteritems():
* phrase = self.pattern2phrase(pattern) # <<<<<<<<<<<<<<
* self.precomputed_collocations[phrase] = arr
* stop_time = monitor_cpu()
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pattern2phrase); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_INCREF(__pyx_v_pattern);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pattern);
- __Pyx_GIVEREF(__pyx_v_pattern);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_pattern2phrase); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_pattern); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_v_pattern);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_pattern);
+ __Pyx_GIVEREF(__pyx_v_pattern);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_XDECREF_SET(__pyx_v_phrase, __pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":505
+ /* "cdec/sa/rulefactory.pxi":505
* for pattern, arr in pre.precomputed_collocations.iteritems():
* phrase = self.pattern2phrase(pattern)
* self.precomputed_collocations[phrase] = arr # <<<<<<<<<<<<<<
@@ -44866,27 +47675,42 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
*/
if (unlikely(PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L13;
}
__pyx_L13:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":506
+ /* "cdec/sa/rulefactory.pxi":506
* phrase = self.pattern2phrase(pattern)
* self.precomputed_collocations[phrase] = arr
* stop_time = monitor_cpu() # <<<<<<<<<<<<<<
* logger.info("Processing precomputations took %f seconds", stop_time - start_time)
*
*/
- __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_v_stop_time = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_9 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ }
+ }
+ if (__pyx_t_9) {
+ __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ } else {
+ __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_stop_time = __pyx_t_8;
+ __pyx_t_8 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":507
+ /* "cdec/sa/rulefactory.pxi":507
* self.precomputed_collocations[phrase] = arr
* stop_time = monitor_cpu()
* logger.info("Processing precomputations took %f seconds", stop_time - start_time) # <<<<<<<<<<<<<<
@@ -44895,29 +47719,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
*/
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_Subtract(__pyx_v_stop_time, __pyx_v_start_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_9, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Processing_precomputations_took);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Processing_precomputations_took);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Processing_precomputations_took);
__Pyx_GIVEREF(__pyx_kp_s_Processing_precomputations_took);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":479
+ /* "cdec/sa/rulefactory.pxi":479
* return patterns
*
* def precompute(self): # <<<<<<<<<<<<<<
@@ -44932,7 +47771,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
- __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -44948,7 +47789,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":510
+/* "cdec/sa/rulefactory.pxi":510
*
*
* def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<<
@@ -44979,12 +47820,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
Py_ssize_t __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_precomputed_collocation", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":511
+ /* "cdec/sa/rulefactory.pxi":511
*
* def get_precomputed_collocation(self, phrase):
* if phrase in self.precomputed_collocations: # <<<<<<<<<<<<<<
@@ -44995,7 +47837,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":512
+ /* "cdec/sa/rulefactory.pxi":512
* def get_precomputed_collocation(self, phrase):
* if phrase in self.precomputed_collocations:
* arr = self.precomputed_collocations[phrase] # <<<<<<<<<<<<<<
@@ -45007,7 +47849,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
__pyx_v_arr = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":513
+ /* "cdec/sa/rulefactory.pxi":513
* if phrase in self.precomputed_collocations:
* arr = self.precomputed_collocations[phrase]
* return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) # <<<<<<<<<<<<<<
@@ -45024,25 +47866,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_arr_high, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_phrase, __pyx_n_s_arity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_phrase, __pyx_n_s_arity); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_7) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else {
+ __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_num_subpatterns, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_num_subpatterns, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":514
+ /* "cdec/sa/rulefactory.pxi":514
* arr = self.precomputed_collocations[phrase]
* return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1)
* return None # <<<<<<<<<<<<<<
@@ -45054,7 +47911,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
__pyx_r = Py_None;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":510
+ /* "cdec/sa/rulefactory.pxi":510
*
*
* def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<<
@@ -45067,6 +47924,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -45076,7 +47934,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomp
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":517
+/* "cdec/sa/rulefactory.pxi":517
*
*
* cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -45114,15 +47972,14 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
+ double __pyx_t_4;
double __pyx_t_5;
- double __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("baeza_yates_helper", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":530
+ /* "cdec/sa/rulefactory.pxi":530
* cdef Matching loc1, loc2
*
* result = <int*> malloc(0*sizeof(int*)) # <<<<<<<<<<<<<<
@@ -45131,7 +47988,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_result = ((int *)malloc((0 * (sizeof(int *)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":532
+ /* "cdec/sa/rulefactory.pxi":532
* result = <int*> malloc(0*sizeof(int*))
*
* d_first = 0 # <<<<<<<<<<<<<<
@@ -45140,7 +47997,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_d_first = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":533
+ /* "cdec/sa/rulefactory.pxi":533
*
* d_first = 0
* if high1 - low1 > high2 - low2: # <<<<<<<<<<<<<<
@@ -45150,7 +48007,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
__pyx_t_1 = (((__pyx_v_high1 - __pyx_v_low1) > (__pyx_v_high2 - __pyx_v_low2)) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":534
+ /* "cdec/sa/rulefactory.pxi":534
* d_first = 0
* if high1 - low1 > high2 - low2:
* d_first = 1 # <<<<<<<<<<<<<<
@@ -45162,23 +48019,27 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":538
+ /* "cdec/sa/rulefactory.pxi":538
* # First, check to see if we are at any of the recursive base cases
* # Case 1: one of the sets is empty
* if low1 >= high1 or low2 >= high2: # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_t_1 = ((__pyx_v_low1 >= __pyx_v_high1) != 0);
- if (!__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_low2 >= __pyx_v_high2) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_low1 >= __pyx_v_high1) != 0);
+ if (!__pyx_t_2) {
+ goto __pyx_L6_next_or;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L6_next_or:;
+ __pyx_t_2 = ((__pyx_v_low2 >= __pyx_v_high2) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":539
+ /* "cdec/sa/rulefactory.pxi":539
* # Case 1: one of the sets is empty
* if low1 >= high1 or low2 >= high2:
* return result # <<<<<<<<<<<<<<
@@ -45189,7 +48050,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":542
+ /* "cdec/sa/rulefactory.pxi":542
*
* # Case 2: sets are non-overlapping
* assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45198,7 +48059,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, (__pyx_v_high1 - __pyx_v_step1), __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":543
+ /* "cdec/sa/rulefactory.pxi":543
* # Case 2: sets are non-overlapping
* assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr)
* assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45207,17 +48068,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_low2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":544
+ /* "cdec/sa/rulefactory.pxi":544
* assign_matching(&loc1, arr1, high1-step1, step1, self.fda.sent_id.arr)
* assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_t_3 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == -1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == -1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":545
+ /* "cdec/sa/rulefactory.pxi":545
* assign_matching(&loc2, arr2, low2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1:
* return result # <<<<<<<<<<<<<<
@@ -45228,7 +48089,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":547
+ /* "cdec/sa/rulefactory.pxi":547
* return result
*
* assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45237,7 +48098,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_low1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":548
+ /* "cdec/sa/rulefactory.pxi":548
*
* assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr)
* assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45246,17 +48107,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, (__pyx_v_high2 - __pyx_v_step2), __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":549
+ /* "cdec/sa/rulefactory.pxi":549
* assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr)
* assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: # <<<<<<<<<<<<<<
* return result
*
*/
- __pyx_t_3 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":550
+ /* "cdec/sa/rulefactory.pxi":550
* assign_matching(&loc2, arr2, high2-step2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1:
* return result # <<<<<<<<<<<<<<
@@ -45267,14 +48128,14 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":554
+ /* "cdec/sa/rulefactory.pxi":554
* # Case 3: query set and data set do not meet size mismatch constraints;
* # We use mergesort instead in this case
* qsetsize = (high1-low1) / step1 # <<<<<<<<<<<<<<
* dsetsize = (high2-low2) / step2
* if d_first:
*/
- __pyx_t_4 = (__pyx_v_high1 - __pyx_v_low1);
+ __pyx_t_3 = (__pyx_v_high1 - __pyx_v_low1);
if (unlikely(__pyx_v_step1 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -45285,7 +48146,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_step1 == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) {
+ else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_step1 == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
@@ -45295,16 +48156,16 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step1);
+ __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_3, __pyx_v_step1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":555
+ /* "cdec/sa/rulefactory.pxi":555
* # We use mergesort instead in this case
* qsetsize = (high1-low1) / step1
* dsetsize = (high2-low2) / step2 # <<<<<<<<<<<<<<
* if d_first:
* tmp = qsetsize
*/
- __pyx_t_4 = (__pyx_v_high2 - __pyx_v_low2);
+ __pyx_t_3 = (__pyx_v_high2 - __pyx_v_low2);
if (unlikely(__pyx_v_step2 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -45315,7 +48176,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_step2 == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) {
+ else if (sizeof(int) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_step2 == (int)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
@@ -45325,19 +48186,19 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step2);
+ __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_3, __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":556
+ /* "cdec/sa/rulefactory.pxi":556
* qsetsize = (high1-low1) / step1
* dsetsize = (high2-low2) / step2
* if d_first: # <<<<<<<<<<<<<<
* tmp = qsetsize
* qsetsize = dsetsize
*/
- __pyx_t_3 = (__pyx_v_d_first != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (__pyx_v_d_first != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":557
+ /* "cdec/sa/rulefactory.pxi":557
* dsetsize = (high2-low2) / step2
* if d_first:
* tmp = qsetsize # <<<<<<<<<<<<<<
@@ -45346,7 +48207,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_tmp = __pyx_v_qsetsize;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":558
+ /* "cdec/sa/rulefactory.pxi":558
* if d_first:
* tmp = qsetsize
* qsetsize = dsetsize # <<<<<<<<<<<<<<
@@ -45355,7 +48216,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_qsetsize = __pyx_v_dsetsize;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":559
+ /* "cdec/sa/rulefactory.pxi":559
* tmp = qsetsize
* qsetsize = dsetsize
* dsetsize = tmp # <<<<<<<<<<<<<<
@@ -45363,20 +48224,20 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize:
*/
__pyx_v_dsetsize = __pyx_v_tmp;
- goto __pyx_L7;
+ goto __pyx_L9;
}
- __pyx_L7:;
+ __pyx_L9:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":561
+ /* "cdec/sa/rulefactory.pxi":561
* dsetsize = tmp
*
* if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: # <<<<<<<<<<<<<<
* free(result)
* return self.merge_helper(low1, high1, arr1, step1, low2, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, result_len)
*/
- __pyx_t_5 = ((__pyx_v_self->by_slack_factor * __pyx_v_qsetsize) * log(__pyx_v_dsetsize));
- __pyx_t_6 = log(2.0);
- if (unlikely(__pyx_t_6 == 0)) {
+ __pyx_t_4 = ((__pyx_v_self->by_slack_factor * __pyx_v_qsetsize) * log(__pyx_v_dsetsize));
+ __pyx_t_5 = log(2.0);
+ if (unlikely(__pyx_t_5 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
@@ -45386,10 +48247,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
#endif
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = (((__pyx_t_5 / __pyx_t_6) > __pyx_v_dsetsize) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_t_4 / __pyx_t_5) > __pyx_v_dsetsize) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":562
+ /* "cdec/sa/rulefactory.pxi":562
*
* if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize:
* free(result) # <<<<<<<<<<<<<<
@@ -45398,7 +48259,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
free(__pyx_v_result);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":563
+ /* "cdec/sa/rulefactory.pxi":563
* if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize:
* free(result)
* return self.merge_helper(low1, high1, arr1, step1, low2, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, result_len) # <<<<<<<<<<<<<<
@@ -45409,17 +48270,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":567
+ /* "cdec/sa/rulefactory.pxi":567
* # binary search. There are two flavors, depending on
* # whether the queryset or dataset is first
* if d_first: # <<<<<<<<<<<<<<
* med2 = median(low2, high2, step2)
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr)
*/
- __pyx_t_3 = (__pyx_v_d_first != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (__pyx_v_d_first != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":568
+ /* "cdec/sa/rulefactory.pxi":568
* # whether the queryset or dataset is first
* if d_first:
* med2 = median(low2, high2, step2) # <<<<<<<<<<<<<<
@@ -45428,7 +48289,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":569
+ /* "cdec/sa/rulefactory.pxi":569
* if d_first:
* med2 = median(low2, high2, step2)
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45437,7 +48298,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":571
+ /* "cdec/sa/rulefactory.pxi":571
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr)
*
* search_low = low1 # <<<<<<<<<<<<<<
@@ -45446,7 +48307,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_search_low = __pyx_v_low1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":572
+ /* "cdec/sa/rulefactory.pxi":572
*
* search_low = low1
* search_high = high1 # <<<<<<<<<<<<<<
@@ -45455,7 +48316,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_search_high = __pyx_v_high1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":573
+ /* "cdec/sa/rulefactory.pxi":573
* search_low = low1
* search_high = high1
* while search_low < search_high: # <<<<<<<<<<<<<<
@@ -45463,10 +48324,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus)
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_search_low < __pyx_v_search_high) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_search_low < __pyx_v_search_high) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":574
+ /* "cdec/sa/rulefactory.pxi":574
* search_high = high1
* while search_low < search_high:
* med1 = median(search_low, search_high, step1) # <<<<<<<<<<<<<<
@@ -45475,7 +48336,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":575
+ /* "cdec/sa/rulefactory.pxi":575
* while search_low < search_high:
* med1 = median(search_low, search_high, step1)
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<<
@@ -45484,7 +48345,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(__pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med1, (&__pyx_v_med1_minus), (&__pyx_v_med1_plus));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576
+ /* "cdec/sa/rulefactory.pxi":576
* med1 = median(search_low, search_high, step1)
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus)
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<<
@@ -45493,7 +48354,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_comparison = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings_set(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":579
+ /* "cdec/sa/rulefactory.pxi":579
* if comparison == -1:
* search_low = med1_plus
* elif comparison == 1: # <<<<<<<<<<<<<<
@@ -45502,7 +48363,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
switch (__pyx_v_comparison) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":577
+ /* "cdec/sa/rulefactory.pxi":577
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus)
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last)
* if comparison == -1: # <<<<<<<<<<<<<<
@@ -45511,7 +48372,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
case -1:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":578
+ /* "cdec/sa/rulefactory.pxi":578
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last)
* if comparison == -1:
* search_low = med1_plus # <<<<<<<<<<<<<<
@@ -45521,7 +48382,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
__pyx_v_search_low = __pyx_v_med1_plus;
break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":579
+ /* "cdec/sa/rulefactory.pxi":579
* if comparison == -1:
* search_low = med1_plus
* elif comparison == 1: # <<<<<<<<<<<<<<
@@ -45530,7 +48391,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
case 1:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":580
+ /* "cdec/sa/rulefactory.pxi":580
* search_low = med1_plus
* elif comparison == 1:
* search_high = med1_minus # <<<<<<<<<<<<<<
@@ -45541,23 +48402,23 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
break;
default:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":582
+ /* "cdec/sa/rulefactory.pxi":582
* search_high = med1_minus
* else:
* break # <<<<<<<<<<<<<<
* else:
* med1 = median(low1, high1, step1)
*/
- goto __pyx_L11_break;
+ goto __pyx_L13_break;
break;
}
}
- __pyx_L11_break:;
- goto __pyx_L9;
+ __pyx_L13_break:;
+ goto __pyx_L11;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":584
+ /* "cdec/sa/rulefactory.pxi":584
* break
* else:
* med1 = median(low1, high1, step1) # <<<<<<<<<<<<<<
@@ -45566,7 +48427,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":585
+ /* "cdec/sa/rulefactory.pxi":585
* else:
* med1 = median(low1, high1, step1)
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<<
@@ -45575,7 +48436,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(__pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med1, (&__pyx_v_med1_minus), (&__pyx_v_med1_plus));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":587
+ /* "cdec/sa/rulefactory.pxi":587
* find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus)
*
* search_low = low2 # <<<<<<<<<<<<<<
@@ -45584,7 +48445,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_search_low = __pyx_v_low2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":588
+ /* "cdec/sa/rulefactory.pxi":588
*
* search_low = low2
* search_high = high2 # <<<<<<<<<<<<<<
@@ -45593,7 +48454,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_search_high = __pyx_v_high2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":589
+ /* "cdec/sa/rulefactory.pxi":589
* search_low = low2
* search_high = high2
* while search_low < search_high: # <<<<<<<<<<<<<<
@@ -45601,10 +48462,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr)
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_search_low < __pyx_v_search_high) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_search_low < __pyx_v_search_high) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":590
+ /* "cdec/sa/rulefactory.pxi":590
* search_high = high2
* while search_low < search_high:
* med2 = median(search_low, search_high, step2) # <<<<<<<<<<<<<<
@@ -45613,7 +48474,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":591
+ /* "cdec/sa/rulefactory.pxi":591
* while search_low < search_high:
* med2 = median(search_low, search_high, step2)
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45622,7 +48483,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592
+ /* "cdec/sa/rulefactory.pxi":592
* med2 = median(search_low, search_high, step2)
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<<
@@ -45631,7 +48492,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_comparison = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings_set(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":595
+ /* "cdec/sa/rulefactory.pxi":595
* if comparison == -1:
* search_high = med2
* elif comparison == 1: # <<<<<<<<<<<<<<
@@ -45640,7 +48501,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
switch (__pyx_v_comparison) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":593
+ /* "cdec/sa/rulefactory.pxi":593
* assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last)
* if comparison == -1: # <<<<<<<<<<<<<<
@@ -45649,7 +48510,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
case -1:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":594
+ /* "cdec/sa/rulefactory.pxi":594
* comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last)
* if comparison == -1:
* search_high = med2 # <<<<<<<<<<<<<<
@@ -45659,7 +48520,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
__pyx_v_search_high = __pyx_v_med2;
break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":595
+ /* "cdec/sa/rulefactory.pxi":595
* if comparison == -1:
* search_high = med2
* elif comparison == 1: # <<<<<<<<<<<<<<
@@ -45668,7 +48529,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
case 1:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":596
+ /* "cdec/sa/rulefactory.pxi":596
* search_high = med2
* elif comparison == 1:
* search_low = med2 + step2 # <<<<<<<<<<<<<<
@@ -45679,22 +48540,22 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
break;
default:
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":598
+ /* "cdec/sa/rulefactory.pxi":598
* search_low = med2 + step2
* else:
* break # <<<<<<<<<<<<<<
*
* med_result_len = 0
*/
- goto __pyx_L13_break;
+ goto __pyx_L15_break;
break;
}
}
- __pyx_L13_break:;
+ __pyx_L15_break:;
}
- __pyx_L9:;
+ __pyx_L11:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":600
+ /* "cdec/sa/rulefactory.pxi":600
* break
*
* med_result_len = 0 # <<<<<<<<<<<<<<
@@ -45703,7 +48564,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med_result_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":601
+ /* "cdec/sa/rulefactory.pxi":601
*
* med_result_len = 0
* med_result = <int*> malloc(0*sizeof(int*)) # <<<<<<<<<<<<<<
@@ -45712,17 +48573,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med_result = ((int *)malloc((0 * (sizeof(int *)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":602
+ /* "cdec/sa/rulefactory.pxi":602
* med_result_len = 0
* med_result = <int*> malloc(0*sizeof(int*))
* if search_high > search_low: # <<<<<<<<<<<<<<
* # Then there is a match for the median element of Q
* # What we want to find is the group of all bindings in the first set
*/
- __pyx_t_3 = ((__pyx_v_search_high > __pyx_v_search_low) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_search_high > __pyx_v_search_low) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":608
+ /* "cdec/sa/rulefactory.pxi":608
* # want to store the bindings for all of those elements. We can
* # subsequently throw all of them away.
* med2_minus = med2 # <<<<<<<<<<<<<<
@@ -45731,7 +48592,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_minus = __pyx_v_med2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":609
+ /* "cdec/sa/rulefactory.pxi":609
* # subsequently throw all of them away.
* med2_minus = med2
* med2_plus = med2 + step2 # <<<<<<<<<<<<<<
@@ -45740,7 +48601,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_plus = (__pyx_v_med2 + __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":610
+ /* "cdec/sa/rulefactory.pxi":610
* med2_minus = med2
* med2_plus = med2 + step2
* i1 = med1_minus # <<<<<<<<<<<<<<
@@ -45749,7 +48610,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_i1 = __pyx_v_med1_minus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":611
+ /* "cdec/sa/rulefactory.pxi":611
* med2_plus = med2 + step2
* i1 = med1_minus
* while i1 < med1_plus: # <<<<<<<<<<<<<<
@@ -45757,10 +48618,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* while med2_minus-step2 >= low2:
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_i1 < __pyx_v_med1_plus) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_i1 < __pyx_v_med1_plus) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":612
+ /* "cdec/sa/rulefactory.pxi":612
* i1 = med1_minus
* while i1 < med1_plus:
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45769,7 +48630,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":613
+ /* "cdec/sa/rulefactory.pxi":613
* while i1 < med1_plus:
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* while med2_minus-step2 >= low2: # <<<<<<<<<<<<<<
@@ -45777,10 +48638,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1:
*/
while (1) {
- __pyx_t_3 = (((__pyx_v_med2_minus - __pyx_v_step2) >= __pyx_v_low2) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = (((__pyx_v_med2_minus - __pyx_v_step2) >= __pyx_v_low2) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":614
+ /* "cdec/sa/rulefactory.pxi":614
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* while med2_minus-step2 >= low2:
* assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45789,17 +48650,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, (__pyx_v_med2_minus - __pyx_v_step2), __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":615
+ /* "cdec/sa/rulefactory.pxi":615
* while med2_minus-step2 >= low2:
* assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: # <<<<<<<<<<<<<<
* med2_minus = med2_minus - step2
* else:
*/
- __pyx_t_3 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) < 1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) < 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":616
+ /* "cdec/sa/rulefactory.pxi":616
* assign_matching(&loc2, arr2, med2_minus-step2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1:
* med2_minus = med2_minus - step2 # <<<<<<<<<<<<<<
@@ -45807,24 +48668,24 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* break
*/
__pyx_v_med2_minus = (__pyx_v_med2_minus - __pyx_v_step2);
- goto __pyx_L19;
+ goto __pyx_L21;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":618
+ /* "cdec/sa/rulefactory.pxi":618
* med2_minus = med2_minus - step2
* else:
* break # <<<<<<<<<<<<<<
* i2 = med2_minus
* while i2 < high2:
*/
- goto __pyx_L18_break;
+ goto __pyx_L20_break;
}
- __pyx_L19:;
+ __pyx_L21:;
}
- __pyx_L18_break:;
+ __pyx_L20_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":619
+ /* "cdec/sa/rulefactory.pxi":619
* else:
* break
* i2 = med2_minus # <<<<<<<<<<<<<<
@@ -45833,7 +48694,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_i2 = __pyx_v_med2_minus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":620
+ /* "cdec/sa/rulefactory.pxi":620
* break
* i2 = med2_minus
* while i2 < high2: # <<<<<<<<<<<<<<
@@ -45841,10 +48702,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last)
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":621
+ /* "cdec/sa/rulefactory.pxi":621
* i2 = med2_minus
* while i2 < high2:
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -45853,7 +48714,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":622
+ /* "cdec/sa/rulefactory.pxi":622
* while i2 < high2:
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<<
@@ -45862,17 +48723,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_comparison = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":623
+ /* "cdec/sa/rulefactory.pxi":623
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last)
* if comparison == 0: # <<<<<<<<<<<<<<
* pass
* med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len)
*/
- __pyx_t_3 = ((__pyx_v_comparison == 0) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_comparison == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":625
+ /* "cdec/sa/rulefactory.pxi":625
* if comparison == 0:
* pass
* med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) # <<<<<<<<<<<<<<
@@ -45880,31 +48741,31 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* break
*/
__pyx_v_med_result = __pyx_f_4cdec_2sa_3_sa_append_combined_matching(__pyx_v_med_result, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_num_subpatterns, (&__pyx_v_med_result_len));
- goto __pyx_L22;
+ goto __pyx_L24;
}
- __pyx_L22:;
+ __pyx_L24:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":626
+ /* "cdec/sa/rulefactory.pxi":626
* pass
* med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len)
* if comparison == -1: # <<<<<<<<<<<<<<
* break
* i2 = i2 + step2
*/
- __pyx_t_3 = ((__pyx_v_comparison == -1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_comparison == -1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":627
+ /* "cdec/sa/rulefactory.pxi":627
* med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len)
* if comparison == -1:
* break # <<<<<<<<<<<<<<
* i2 = i2 + step2
* if i2 > med2_plus:
*/
- goto __pyx_L21_break;
+ goto __pyx_L23_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":628
+ /* "cdec/sa/rulefactory.pxi":628
* if comparison == -1:
* break
* i2 = i2 + step2 # <<<<<<<<<<<<<<
@@ -45913,19 +48774,19 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2);
}
- __pyx_L21_break:;
+ __pyx_L23_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":629
+ /* "cdec/sa/rulefactory.pxi":629
* break
* i2 = i2 + step2
* if i2 > med2_plus: # <<<<<<<<<<<<<<
* med2_plus = i2
* i1 = i1 + step1
*/
- __pyx_t_3 = ((__pyx_v_i2 > __pyx_v_med2_plus) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_i2 > __pyx_v_med2_plus) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":630
+ /* "cdec/sa/rulefactory.pxi":630
* i2 = i2 + step2
* if i2 > med2_plus:
* med2_plus = i2 # <<<<<<<<<<<<<<
@@ -45933,11 +48794,11 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*
*/
__pyx_v_med2_plus = __pyx_v_i2;
- goto __pyx_L24;
+ goto __pyx_L26;
}
- __pyx_L24:;
+ __pyx_L26:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":631
+ /* "cdec/sa/rulefactory.pxi":631
* if i2 > med2_plus:
* med2_plus = i2
* i1 = i1 + step1 # <<<<<<<<<<<<<<
@@ -45947,7 +48808,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
__pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":633
+ /* "cdec/sa/rulefactory.pxi":633
* i1 = i1 + step1
*
* tmp = med1_minus # <<<<<<<<<<<<<<
@@ -45956,7 +48817,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_tmp = __pyx_v_med1_minus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":634
+ /* "cdec/sa/rulefactory.pxi":634
*
* tmp = med1_minus
* med1_minus = med1_plus # <<<<<<<<<<<<<<
@@ -45965,7 +48826,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med1_minus = __pyx_v_med1_plus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":635
+ /* "cdec/sa/rulefactory.pxi":635
* tmp = med1_minus
* med1_minus = med1_plus
* med1_plus = tmp # <<<<<<<<<<<<<<
@@ -45973,11 +48834,11 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* # No match; need to figure out the point of division in D and Q
*/
__pyx_v_med1_plus = __pyx_v_tmp;
- goto __pyx_L14;
+ goto __pyx_L16;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":638
+ /* "cdec/sa/rulefactory.pxi":638
* else:
* # No match; need to figure out the point of division in D and Q
* med2_minus = med2 # <<<<<<<<<<<<<<
@@ -45986,7 +48847,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_minus = __pyx_v_med2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":639
+ /* "cdec/sa/rulefactory.pxi":639
* # No match; need to figure out the point of division in D and Q
* med2_minus = med2
* med2_plus = med2 # <<<<<<<<<<<<<<
@@ -45995,17 +48856,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_plus = __pyx_v_med2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":640
+ /* "cdec/sa/rulefactory.pxi":640
* med2_minus = med2
* med2_plus = med2
* if d_first: # <<<<<<<<<<<<<<
* med2_minus = med2_minus + step2
* if comparison == -1:
*/
- __pyx_t_3 = (__pyx_v_d_first != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (__pyx_v_d_first != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":641
+ /* "cdec/sa/rulefactory.pxi":641
* med2_plus = med2
* if d_first:
* med2_minus = med2_minus + step2 # <<<<<<<<<<<<<<
@@ -46014,17 +48875,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":642
+ /* "cdec/sa/rulefactory.pxi":642
* if d_first:
* med2_minus = med2_minus + step2
* if comparison == -1: # <<<<<<<<<<<<<<
* med1_minus = med1_plus
* if comparison == 1:
*/
- __pyx_t_3 = ((__pyx_v_comparison == -1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_comparison == -1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":643
+ /* "cdec/sa/rulefactory.pxi":643
* med2_minus = med2_minus + step2
* if comparison == -1:
* med1_minus = med1_plus # <<<<<<<<<<<<<<
@@ -46032,21 +48893,21 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* med1_plus = med1_minus
*/
__pyx_v_med1_minus = __pyx_v_med1_plus;
- goto __pyx_L26;
+ goto __pyx_L28;
}
- __pyx_L26:;
+ __pyx_L28:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":644
+ /* "cdec/sa/rulefactory.pxi":644
* if comparison == -1:
* med1_minus = med1_plus
* if comparison == 1: # <<<<<<<<<<<<<<
* med1_plus = med1_minus
* else:
*/
- __pyx_t_3 = ((__pyx_v_comparison == 1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_comparison == 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":645
+ /* "cdec/sa/rulefactory.pxi":645
* med1_minus = med1_plus
* if comparison == 1:
* med1_plus = med1_minus # <<<<<<<<<<<<<<
@@ -46054,14 +48915,14 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* tmp = med1_minus
*/
__pyx_v_med1_plus = __pyx_v_med1_minus;
- goto __pyx_L27;
+ goto __pyx_L29;
}
- __pyx_L27:;
- goto __pyx_L25;
+ __pyx_L29:;
+ goto __pyx_L27;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":647
+ /* "cdec/sa/rulefactory.pxi":647
* med1_plus = med1_minus
* else:
* tmp = med1_minus # <<<<<<<<<<<<<<
@@ -46070,7 +48931,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_tmp = __pyx_v_med1_minus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":648
+ /* "cdec/sa/rulefactory.pxi":648
* else:
* tmp = med1_minus
* med1_minus = med1_plus # <<<<<<<<<<<<<<
@@ -46079,7 +48940,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med1_minus = __pyx_v_med1_plus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":649
+ /* "cdec/sa/rulefactory.pxi":649
* tmp = med1_minus
* med1_minus = med1_plus
* med1_plus = tmp # <<<<<<<<<<<<<<
@@ -46088,17 +48949,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med1_plus = __pyx_v_tmp;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":650
+ /* "cdec/sa/rulefactory.pxi":650
* med1_minus = med1_plus
* med1_plus = tmp
* if comparison == 1: # <<<<<<<<<<<<<<
* med2_minus = med2_minus + step2
* med2_plus = med2_plus + step2
*/
- __pyx_t_3 = ((__pyx_v_comparison == 1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((__pyx_v_comparison == 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":651
+ /* "cdec/sa/rulefactory.pxi":651
* med1_plus = tmp
* if comparison == 1:
* med2_minus = med2_minus + step2 # <<<<<<<<<<<<<<
@@ -46107,7 +48968,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":652
+ /* "cdec/sa/rulefactory.pxi":652
* if comparison == 1:
* med2_minus = med2_minus + step2
* med2_plus = med2_plus + step2 # <<<<<<<<<<<<<<
@@ -46115,15 +48976,15 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
* low_result_len = 0
*/
__pyx_v_med2_plus = (__pyx_v_med2_plus + __pyx_v_step2);
- goto __pyx_L28;
+ goto __pyx_L30;
}
- __pyx_L28:;
+ __pyx_L30:;
}
- __pyx_L25:;
+ __pyx_L27:;
}
- __pyx_L14:;
+ __pyx_L16:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":654
+ /* "cdec/sa/rulefactory.pxi":654
* med2_plus = med2_plus + step2
*
* low_result_len = 0 # <<<<<<<<<<<<<<
@@ -46132,7 +48993,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_low_result_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":655
+ /* "cdec/sa/rulefactory.pxi":655
*
* low_result_len = 0
* low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len) # <<<<<<<<<<<<<<
@@ -46141,7 +49002,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_low_result = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_med1_plus, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_med2_plus, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_low_result_len));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":656
+ /* "cdec/sa/rulefactory.pxi":656
* low_result_len = 0
* low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len)
* high_result_len = 0 # <<<<<<<<<<<<<<
@@ -46150,7 +49011,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_high_result_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":657
+ /* "cdec/sa/rulefactory.pxi":657
* low_result = self.baeza_yates_helper(low1, med1_plus, arr1, step1, low2, med2_plus, arr2, step2, offset_by_one, len_last, num_subpatterns, &low_result_len)
* high_result_len = 0
* high_result = self.baeza_yates_helper(med1_minus, high1, arr1, step1, med2_minus, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, &high_result_len) # <<<<<<<<<<<<<<
@@ -46159,7 +49020,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_high_result = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_med1_minus, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_med2_minus, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_high_result_len));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":659
+ /* "cdec/sa/rulefactory.pxi":659
* high_result = self.baeza_yates_helper(med1_minus, high1, arr1, step1, med2_minus, high2, arr2, step2, offset_by_one, len_last, num_subpatterns, &high_result_len)
*
* result = extend_arr(result, result_len, low_result, low_result_len) # <<<<<<<<<<<<<<
@@ -46168,7 +49029,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_result = __pyx_f_4cdec_2sa_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_low_result, __pyx_v_low_result_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":660
+ /* "cdec/sa/rulefactory.pxi":660
*
* result = extend_arr(result, result_len, low_result, low_result_len)
* result = extend_arr(result, result_len, med_result, med_result_len) # <<<<<<<<<<<<<<
@@ -46177,7 +49038,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_result = __pyx_f_4cdec_2sa_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_med_result, __pyx_v_med_result_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":661
+ /* "cdec/sa/rulefactory.pxi":661
* result = extend_arr(result, result_len, low_result, low_result_len)
* result = extend_arr(result, result_len, med_result, med_result_len)
* result = extend_arr(result, result_len, high_result, high_result_len) # <<<<<<<<<<<<<<
@@ -46186,7 +49047,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
__pyx_v_result = __pyx_f_4cdec_2sa_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_high_result, __pyx_v_high_result_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":662
+ /* "cdec/sa/rulefactory.pxi":662
* result = extend_arr(result, result_len, med_result, med_result_len)
* result = extend_arr(result, result_len, high_result, high_result_len)
* free(low_result) # <<<<<<<<<<<<<<
@@ -46195,7 +49056,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
free(__pyx_v_low_result);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":663
+ /* "cdec/sa/rulefactory.pxi":663
* result = extend_arr(result, result_len, high_result, high_result_len)
* free(low_result)
* free(med_result) # <<<<<<<<<<<<<<
@@ -46204,7 +49065,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
free(__pyx_v_med_result);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":664
+ /* "cdec/sa/rulefactory.pxi":664
* free(low_result)
* free(med_result)
* free(high_result) # <<<<<<<<<<<<<<
@@ -46213,7 +49074,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
*/
free(__pyx_v_high_result);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":666
+ /* "cdec/sa/rulefactory.pxi":666
* free(high_result)
*
* return result # <<<<<<<<<<<<<<
@@ -46223,7 +49084,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":517
+ /* "cdec/sa/rulefactory.pxi":517
*
*
* cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -46240,7 +49101,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":670
+/* "cdec/sa/rulefactory.pxi":670
*
*
* cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -46259,7 +49120,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
int __pyx_t_1;
__Pyx_RefNannySetupContext("compare_matchings_set", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":681
+ /* "cdec/sa/rulefactory.pxi":681
* cdef Matching* loc1
*
* loc1 = &l1_stack # <<<<<<<<<<<<<<
@@ -46268,7 +49129,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_v_loc1 = (&__pyx_v_l1_stack);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":683
+ /* "cdec/sa/rulefactory.pxi":683
* loc1 = &l1_stack
*
* i1 = i1_minus # <<<<<<<<<<<<<<
@@ -46277,7 +49138,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_v_i1 = __pyx_v_i1_minus;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":684
+ /* "cdec/sa/rulefactory.pxi":684
*
* i1 = i1_minus
* while i1 < i1_plus: # <<<<<<<<<<<<<<
@@ -46288,7 +49149,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
__pyx_t_1 = ((__pyx_v_i1 < __pyx_v_i1_plus) != 0);
if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":685
+ /* "cdec/sa/rulefactory.pxi":685
* i1 = i1_minus
* while i1 < i1_plus:
* assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -46297,7 +49158,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching(__pyx_v_loc1, __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":686
+ /* "cdec/sa/rulefactory.pxi":686
* while i1 < i1_plus:
* assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr)
* comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) # <<<<<<<<<<<<<<
@@ -46306,7 +49167,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_v_comparison = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, __pyx_v_loc1, __pyx_v_loc2, __pyx_v_offset_by_one, __pyx_v_len_last);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":687
+ /* "cdec/sa/rulefactory.pxi":687
* assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr)
* comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last)
* if comparison == 0: # <<<<<<<<<<<<<<
@@ -46316,7 +49177,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
__pyx_t_1 = ((__pyx_v_comparison == 0) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":688
+ /* "cdec/sa/rulefactory.pxi":688
* comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last)
* if comparison == 0:
* prev_comparison = 0 # <<<<<<<<<<<<<<
@@ -46325,7 +49186,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_v_prev_comparison = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":689
+ /* "cdec/sa/rulefactory.pxi":689
* if comparison == 0:
* prev_comparison = 0
* break # <<<<<<<<<<<<<<
@@ -46335,7 +49196,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
goto __pyx_L4_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":690
+ /* "cdec/sa/rulefactory.pxi":690
* prev_comparison = 0
* break
* elif i1 == i1_minus: # <<<<<<<<<<<<<<
@@ -46345,7 +49206,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
__pyx_t_1 = ((__pyx_v_i1 == __pyx_v_i1_minus) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":691
+ /* "cdec/sa/rulefactory.pxi":691
* break
* elif i1 == i1_minus:
* prev_comparison = comparison # <<<<<<<<<<<<<<
@@ -46357,7 +49218,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":693
+ /* "cdec/sa/rulefactory.pxi":693
* prev_comparison = comparison
* else:
* if comparison != prev_comparison: # <<<<<<<<<<<<<<
@@ -46367,7 +49228,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
__pyx_t_1 = ((__pyx_v_comparison != __pyx_v_prev_comparison) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":694
+ /* "cdec/sa/rulefactory.pxi":694
* else:
* if comparison != prev_comparison:
* prev_comparison = 0 # <<<<<<<<<<<<<<
@@ -46376,7 +49237,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
*/
__pyx_v_prev_comparison = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":695
+ /* "cdec/sa/rulefactory.pxi":695
* if comparison != prev_comparison:
* prev_comparison = 0
* break # <<<<<<<<<<<<<<
@@ -46388,7 +49249,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":696
+ /* "cdec/sa/rulefactory.pxi":696
* prev_comparison = 0
* break
* i1 = i1 + step1 # <<<<<<<<<<<<<<
@@ -46399,7 +49260,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
}
__pyx_L4_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":697
+ /* "cdec/sa/rulefactory.pxi":697
* break
* i1 = i1 + step1
* return prev_comparison # <<<<<<<<<<<<<<
@@ -46409,7 +49270,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
__pyx_r = __pyx_v_prev_comparison;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":670
+ /* "cdec/sa/rulefactory.pxi":670
*
*
* cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -46423,7 +49284,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":700
+/* "cdec/sa/rulefactory.pxi":700
*
*
* cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<<
@@ -46438,10 +49299,9 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
__Pyx_RefNannySetupContext("compare_matchings", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":703
+ /* "cdec/sa/rulefactory.pxi":703
* cdef int i
*
* if loc1.sent_id > loc2.sent_id: # <<<<<<<<<<<<<<
@@ -46451,7 +49311,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
__pyx_t_1 = ((__pyx_v_loc1->sent_id > __pyx_v_loc2->sent_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":704
+ /* "cdec/sa/rulefactory.pxi":704
*
* if loc1.sent_id > loc2.sent_id:
* return 1 # <<<<<<<<<<<<<<
@@ -46462,7 +49322,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":705
+ /* "cdec/sa/rulefactory.pxi":705
* if loc1.sent_id > loc2.sent_id:
* return 1
* if loc2.sent_id > loc1.sent_id: # <<<<<<<<<<<<<<
@@ -46472,7 +49332,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
__pyx_t_1 = ((__pyx_v_loc2->sent_id > __pyx_v_loc1->sent_id) != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":706
+ /* "cdec/sa/rulefactory.pxi":706
* return 1
* if loc2.sent_id > loc1.sent_id:
* return -1 # <<<<<<<<<<<<<<
@@ -46483,33 +49343,37 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":708
+ /* "cdec/sa/rulefactory.pxi":708
* return -1
*
* if loc1.size == 1 and loc2.size == 1: # <<<<<<<<<<<<<<
* if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size:
* return 1
*/
- __pyx_t_1 = ((__pyx_v_loc1->size == 1) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_loc2->size == 1) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_loc1->size == 1) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L7_next_and;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L6_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L7_next_and:;
+ __pyx_t_2 = ((__pyx_v_loc2->size == 1) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L6_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":709
+ /* "cdec/sa/rulefactory.pxi":709
*
* if loc1.size == 1 and loc2.size == 1:
* if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: # <<<<<<<<<<<<<<
* return 1
*
*/
- __pyx_t_3 = ((((__pyx_v_loc2->arr[__pyx_v_loc2->start]) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) <= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((__pyx_v_loc2->arr[__pyx_v_loc2->start]) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) <= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":710
+ /* "cdec/sa/rulefactory.pxi":710
* if loc1.size == 1 and loc2.size == 1:
* if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size:
* return 1 # <<<<<<<<<<<<<<
@@ -46522,37 +49386,37 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L5;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":712
+ /* "cdec/sa/rulefactory.pxi":712
* return 1
*
* elif offset_by_one: # <<<<<<<<<<<<<<
* for i from 1 <= i < loc1.size:
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]:
*/
- __pyx_t_3 = (__pyx_v_offset_by_one != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (__pyx_v_offset_by_one != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":713
+ /* "cdec/sa/rulefactory.pxi":713
*
* elif offset_by_one:
* for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<<
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]:
* return 1
*/
- __pyx_t_4 = __pyx_v_loc1->size;
- for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
+ __pyx_t_3 = __pyx_v_loc1->size;
+ for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":714
+ /* "cdec/sa/rulefactory.pxi":714
* elif offset_by_one:
* for i from 1 <= i < loc1.size:
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: # <<<<<<<<<<<<<<
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]:
*/
- __pyx_t_3 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":715
+ /* "cdec/sa/rulefactory.pxi":715
* for i from 1 <= i < loc1.size:
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]:
* return 1 # <<<<<<<<<<<<<<
@@ -46563,17 +49427,17 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":716
+ /* "cdec/sa/rulefactory.pxi":716
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]:
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: # <<<<<<<<<<<<<<
* return -1
*
*/
- __pyx_t_3 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[((__pyx_v_loc2->start + __pyx_v_i) - 1)])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":717
+ /* "cdec/sa/rulefactory.pxi":717
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]:
* return -1 # <<<<<<<<<<<<<<
@@ -46588,17 +49452,17 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":720
+ /* "cdec/sa/rulefactory.pxi":720
*
* else:
* if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: # <<<<<<<<<<<<<<
* return 1
* if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]:
*/
- __pyx_t_3 = ((((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) > (__pyx_v_loc2->arr[__pyx_v_loc2->start])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) > (__pyx_v_loc2->arr[__pyx_v_loc2->start])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":721
+ /* "cdec/sa/rulefactory.pxi":721
* else:
* if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]:
* return 1 # <<<<<<<<<<<<<<
@@ -46609,17 +49473,17 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":722
+ /* "cdec/sa/rulefactory.pxi":722
* if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]:
* return 1
* if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: # <<<<<<<<<<<<<<
* return -1
*
*/
- __pyx_t_3 = ((((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) < (__pyx_v_loc2->arr[__pyx_v_loc2->start])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((__pyx_v_loc1->arr[__pyx_v_loc1->start]) + 1) < (__pyx_v_loc2->arr[__pyx_v_loc2->start])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":723
+ /* "cdec/sa/rulefactory.pxi":723
* return 1
* if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]:
* return -1 # <<<<<<<<<<<<<<
@@ -46630,27 +49494,27 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":725
+ /* "cdec/sa/rulefactory.pxi":725
* return -1
*
* for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<<
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]:
* return 1
*/
- __pyx_t_4 = __pyx_v_loc1->size;
- for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
+ __pyx_t_3 = __pyx_v_loc1->size;
+ for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":726
+ /* "cdec/sa/rulefactory.pxi":726
*
* for i from 1 <= i < loc1.size:
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<<
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]:
*/
- __pyx_t_3 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) > (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":727
+ /* "cdec/sa/rulefactory.pxi":727
* for i from 1 <= i < loc1.size:
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]:
* return 1 # <<<<<<<<<<<<<<
@@ -46661,17 +49525,17 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":728
+ /* "cdec/sa/rulefactory.pxi":728
* if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]:
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<<
* return -1
*
*/
- __pyx_t_3 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]) < (__pyx_v_loc2->arr[(__pyx_v_loc2->start + __pyx_v_i)])) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":729
+ /* "cdec/sa/rulefactory.pxi":729
* return 1
* if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]:
* return -1 # <<<<<<<<<<<<<<
@@ -46685,17 +49549,17 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":731
+ /* "cdec/sa/rulefactory.pxi":731
* return -1
*
* if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: # <<<<<<<<<<<<<<
* return -1
* return 0
*/
- __pyx_t_3 = (((((__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]) + __pyx_v_len_last) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) > __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = (((((__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]) + __pyx_v_len_last) - (__pyx_v_loc1->arr[__pyx_v_loc1->start])) > __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":732
+ /* "cdec/sa/rulefactory.pxi":732
*
* if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size:
* return -1 # <<<<<<<<<<<<<<
@@ -46706,7 +49570,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":733
+ /* "cdec/sa/rulefactory.pxi":733
* if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size:
* return -1
* return 0 # <<<<<<<<<<<<<<
@@ -46716,7 +49580,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
__pyx_r = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":700
+ /* "cdec/sa/rulefactory.pxi":700
*
*
* cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<<
@@ -46730,7 +49594,7 @@ static long __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings(s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":736
+/* "cdec/sa/rulefactory.pxi":736
*
*
* cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -46751,10 +49615,9 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
- int __pyx_t_3;
__Pyx_RefNannySetupContext("merge_helper", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":744
+ /* "cdec/sa/rulefactory.pxi":744
* cdef Matching loc1, loc2
*
* result_len[0] = 0 # <<<<<<<<<<<<<<
@@ -46763,7 +49626,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
(__pyx_v_result_len[0]) = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":745
+ /* "cdec/sa/rulefactory.pxi":745
*
* result_len[0] = 0
* result = <int*> malloc(0*sizeof(int)) # <<<<<<<<<<<<<<
@@ -46772,7 +49635,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_result = ((int *)malloc((0 * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":747
+ /* "cdec/sa/rulefactory.pxi":747
* result = <int*> malloc(0*sizeof(int))
*
* i1 = low1 # <<<<<<<<<<<<<<
@@ -46781,7 +49644,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_i1 = __pyx_v_low1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":748
+ /* "cdec/sa/rulefactory.pxi":748
*
* i1 = low1
* i2 = low2 # <<<<<<<<<<<<<<
@@ -46790,7 +49653,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_i2 = __pyx_v_low2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":749
+ /* "cdec/sa/rulefactory.pxi":749
* i1 = low1
* i2 = low2
* while i1 < high1 and i2 < high2: # <<<<<<<<<<<<<<
@@ -46798,16 +49661,20 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* # First, pop all unneeded loc2's off the stack
*/
while (1) {
- __pyx_t_1 = ((__pyx_v_i1 < __pyx_v_high1) != 0);
- if (__pyx_t_1) {
- __pyx_t_2 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_2 = ((__pyx_v_i1 < __pyx_v_high1) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L6_next_and;
} else {
- __pyx_t_3 = __pyx_t_1;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
}
- if (!__pyx_t_3) break;
+ __pyx_L6_next_and:;
+ __pyx_t_2 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":752
+ /* "cdec/sa/rulefactory.pxi":752
*
* # First, pop all unneeded loc2's off the stack
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -46816,7 +49683,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":753
+ /* "cdec/sa/rulefactory.pxi":753
* # First, pop all unneeded loc2's off the stack
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* while i2 < high2: # <<<<<<<<<<<<<<
@@ -46824,10 +49691,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1:
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
- if (!__pyx_t_3) break;
+ __pyx_t_1 = ((__pyx_v_i2 < __pyx_v_high2) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":754
+ /* "cdec/sa/rulefactory.pxi":754
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* while i2 < high2:
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -46836,17 +49703,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":755
+ /* "cdec/sa/rulefactory.pxi":755
* while i2 < high2:
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: # <<<<<<<<<<<<<<
* i2 = i2 + step2
* else:
*/
- __pyx_t_3 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1) != 0);
- if (__pyx_t_3) {
+ __pyx_t_1 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last) == 1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":756
+ /* "cdec/sa/rulefactory.pxi":756
* assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr)
* if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1:
* i2 = i2 + step2 # <<<<<<<<<<<<<<
@@ -46854,24 +49721,24 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* break
*/
__pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2);
- goto __pyx_L7;
+ goto __pyx_L9;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":758
+ /* "cdec/sa/rulefactory.pxi":758
* i2 = i2 + step2
* else:
* break # <<<<<<<<<<<<<<
*
* # Next: process all loc1's with the same starting val
*/
- goto __pyx_L6_break;
+ goto __pyx_L8_break;
}
- __pyx_L7:;
+ __pyx_L9:;
}
- __pyx_L6_break:;
+ __pyx_L8_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":761
+ /* "cdec/sa/rulefactory.pxi":761
*
* # Next: process all loc1's with the same starting val
* j1 = i1 # <<<<<<<<<<<<<<
@@ -46880,7 +49747,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_j1 = __pyx_v_i1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":762
+ /* "cdec/sa/rulefactory.pxi":762
* # Next: process all loc1's with the same starting val
* j1 = i1
* while i1 < high1 and arr1[j1] == arr1[i1]: # <<<<<<<<<<<<<<
@@ -46888,16 +49755,20 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* j2 = i2
*/
while (1) {
- __pyx_t_3 = ((__pyx_v_i1 < __pyx_v_high1) != 0);
- if (__pyx_t_3) {
- __pyx_t_1 = (((__pyx_v_arr1[__pyx_v_j1]) == (__pyx_v_arr1[__pyx_v_i1])) != 0);
- __pyx_t_2 = __pyx_t_1;
+ __pyx_t_2 = ((__pyx_v_i1 < __pyx_v_high1) != 0);
+ if (__pyx_t_2) {
+ goto __pyx_L13_next_and;
} else {
- __pyx_t_2 = __pyx_t_3;
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L12_bool_binop_done;
}
- if (!__pyx_t_2) break;
+ __pyx_L13_next_and:;
+ __pyx_t_2 = (((__pyx_v_arr1[__pyx_v_j1]) == (__pyx_v_arr1[__pyx_v_i1])) != 0);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L12_bool_binop_done:;
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":763
+ /* "cdec/sa/rulefactory.pxi":763
* j1 = i1
* while i1 < high1 and arr1[j1] == arr1[i1]:
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -46906,7 +49777,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":764
+ /* "cdec/sa/rulefactory.pxi":764
* while i1 < high1 and arr1[j1] == arr1[i1]:
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* j2 = i2 # <<<<<<<<<<<<<<
@@ -46915,7 +49786,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_j2 = __pyx_v_i2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":765
+ /* "cdec/sa/rulefactory.pxi":765
* assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr)
* j2 = i2
* while j2 < high2: # <<<<<<<<<<<<<<
@@ -46923,10 +49794,10 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last)
*/
while (1) {
- __pyx_t_2 = ((__pyx_v_j2 < __pyx_v_high2) != 0);
- if (!__pyx_t_2) break;
+ __pyx_t_1 = ((__pyx_v_j2 < __pyx_v_high2) != 0);
+ if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":766
+ /* "cdec/sa/rulefactory.pxi":766
* j2 = i2
* while j2 < high2:
* assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -46935,7 +49806,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_j2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":767
+ /* "cdec/sa/rulefactory.pxi":767
* while j2 < high2:
* assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) # <<<<<<<<<<<<<<
@@ -46944,17 +49815,17 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
*/
__pyx_v_comparison = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->compare_matchings(__pyx_v_self, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_len_last);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":768
+ /* "cdec/sa/rulefactory.pxi":768
* assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr)
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last)
* if comparison == 0: # <<<<<<<<<<<<<<
* result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len)
* if comparison == 1:
*/
- __pyx_t_2 = ((__pyx_v_comparison == 0) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_comparison == 0) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":769
+ /* "cdec/sa/rulefactory.pxi":769
* comparison = self.compare_matchings(&loc1, &loc2, offset_by_one, len_last)
* if comparison == 0:
* result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) # <<<<<<<<<<<<<<
@@ -46962,45 +49833,45 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
* pass
*/
__pyx_v_result = __pyx_f_4cdec_2sa_3_sa_append_combined_matching(__pyx_v_result, (&__pyx_v_loc1), (&__pyx_v_loc2), __pyx_v_offset_by_one, __pyx_v_num_subpatterns, __pyx_v_result_len);
- goto __pyx_L12;
+ goto __pyx_L16;
}
- __pyx_L12:;
+ __pyx_L16:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":770
+ /* "cdec/sa/rulefactory.pxi":770
* if comparison == 0:
* result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len)
* if comparison == 1: # <<<<<<<<<<<<<<
* pass
* if comparison == -1:
*/
- __pyx_t_2 = ((__pyx_v_comparison == 1) != 0);
- if (__pyx_t_2) {
- goto __pyx_L13;
+ __pyx_t_1 = ((__pyx_v_comparison == 1) != 0);
+ if (__pyx_t_1) {
+ goto __pyx_L17;
}
- __pyx_L13:;
+ __pyx_L17:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":772
+ /* "cdec/sa/rulefactory.pxi":772
* if comparison == 1:
* pass
* if comparison == -1: # <<<<<<<<<<<<<<
* break
* else:
*/
- __pyx_t_2 = ((__pyx_v_comparison == -1) != 0);
- if (__pyx_t_2) {
+ __pyx_t_1 = ((__pyx_v_comparison == -1) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":773
+ /* "cdec/sa/rulefactory.pxi":773
* pass
* if comparison == -1:
* break # <<<<<<<<<<<<<<
* else:
* j2 = j2 + step2
*/
- goto __pyx_L11_break;
+ goto __pyx_L15_break;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":775
+ /* "cdec/sa/rulefactory.pxi":775
* break
* else:
* j2 = j2 + step2 # <<<<<<<<<<<<<<
@@ -47010,9 +49881,9 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
__pyx_v_j2 = (__pyx_v_j2 + __pyx_v_step2);
}
}
- __pyx_L11_break:;
+ __pyx_L15_break:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":776
+ /* "cdec/sa/rulefactory.pxi":776
* else:
* j2 = j2 + step2
* i1 = i1 + step1 # <<<<<<<<<<<<<<
@@ -47023,7 +49894,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":777
+ /* "cdec/sa/rulefactory.pxi":777
* j2 = j2 + step2
* i1 = i1 + step1
* return result # <<<<<<<<<<<<<<
@@ -47033,7 +49904,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":736
+ /* "cdec/sa/rulefactory.pxi":736
*
*
* cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<<
@@ -47047,7 +49918,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper(struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":780
+/* "cdec/sa/rulefactory.pxi":780
*
*
* cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<<
@@ -47070,7 +49941,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("sort_phrase_loc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":785
+ /* "cdec/sa/rulefactory.pxi":785
* cdef IntList result
*
* if phrase in self.precomputed_index: # <<<<<<<<<<<<<<
@@ -47081,7 +49952,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":786
+ /* "cdec/sa/rulefactory.pxi":786
*
* if phrase in self.precomputed_index:
* loc.arr = self.precomputed_index[phrase] # <<<<<<<<<<<<<<
@@ -47100,7 +49971,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":788
+ /* "cdec/sa/rulefactory.pxi":788
* loc.arr = self.precomputed_index[phrase]
* else:
* loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) # <<<<<<<<<<<<<<
@@ -47122,7 +49993,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":789
+ /* "cdec/sa/rulefactory.pxi":789
* else:
* loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low)
* veb = VEB(arr.len) # <<<<<<<<<<<<<<
@@ -47142,7 +50013,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":790
+ /* "cdec/sa/rulefactory.pxi":790
* loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low)
* veb = VEB(arr.len)
* for i from loc.sa_low <= i < loc.sa_high: # <<<<<<<<<<<<<<
@@ -47152,7 +50023,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_t_5 = __pyx_v_loc->sa_high;
for (__pyx_v_i = __pyx_v_loc->sa_low; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":791
+ /* "cdec/sa/rulefactory.pxi":791
* veb = VEB(arr.len)
* for i from loc.sa_low <= i < loc.sa_high:
* veb._insert(arr.arr[i]) # <<<<<<<<<<<<<<
@@ -47162,7 +50033,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i]));
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":792
+ /* "cdec/sa/rulefactory.pxi":792
* for i from loc.sa_low <= i < loc.sa_high:
* veb._insert(arr.arr[i])
* i = veb.veb.min_val # <<<<<<<<<<<<<<
@@ -47172,7 +50043,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_t_5 = __pyx_v_veb->veb->min_val;
__pyx_v_i = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":793
+ /* "cdec/sa/rulefactory.pxi":793
* veb._insert(arr.arr[i])
* i = veb.veb.min_val
* for j from 0 <= j < loc.sa_high-loc.sa_low: # <<<<<<<<<<<<<<
@@ -47182,7 +50053,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_t_5 = (__pyx_v_loc->sa_high - __pyx_v_loc->sa_low);
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_5; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":794
+ /* "cdec/sa/rulefactory.pxi":794
* i = veb.veb.min_val
* for j from 0 <= j < loc.sa_high-loc.sa_low:
* loc.arr.arr[j] = i # <<<<<<<<<<<<<<
@@ -47191,7 +50062,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
*/
(__pyx_v_loc->arr->arr[__pyx_v_j]) = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":795
+ /* "cdec/sa/rulefactory.pxi":795
* for j from 0 <= j < loc.sa_high-loc.sa_low:
* loc.arr.arr[j] = i
* i = veb._findsucc(i) # <<<<<<<<<<<<<<
@@ -47203,7 +50074,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":796
+ /* "cdec/sa/rulefactory.pxi":796
* loc.arr.arr[j] = i
* i = veb._findsucc(i)
* loc.arr_low = 0 # <<<<<<<<<<<<<<
@@ -47212,7 +50083,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
*/
__pyx_v_loc->arr_low = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":797
+ /* "cdec/sa/rulefactory.pxi":797
* i = veb._findsucc(i)
* loc.arr_low = 0
* loc.arr_high = loc.arr.len # <<<<<<<<<<<<<<
@@ -47222,7 +50093,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__pyx_t_5 = __pyx_v_loc->arr->len;
__pyx_v_loc->arr_high = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":780
+ /* "cdec/sa/rulefactory.pxi":780
*
*
* cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<<
@@ -47241,7 +50112,7 @@ static void __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(str
__Pyx_RefNannyFinishContext();
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":800
+/* "cdec/sa/rulefactory.pxi":800
*
*
* cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<<
@@ -47271,14 +50142,16 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
- Py_ssize_t __pyx_t_6;
- int __pyx_t_7;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
+ int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect_helper", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":807
+ /* "cdec/sa/rulefactory.pxi":807
* cdef int* result_ptr
*
* result_len = 0 # <<<<<<<<<<<<<<
@@ -47287,7 +50160,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
__pyx_v_result_len = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":809
+ /* "cdec/sa/rulefactory.pxi":809
* result_len = 0
*
* if sym_isvar(suffix[0]): # <<<<<<<<<<<<<<
@@ -47301,7 +50174,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_2) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":810
+ /* "cdec/sa/rulefactory.pxi":810
*
* if sym_isvar(suffix[0]):
* offset_by_one = 1 # <<<<<<<<<<<<<<
@@ -47313,7 +50186,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":812
+ /* "cdec/sa/rulefactory.pxi":812
* offset_by_one = 1
* else:
* offset_by_one = 0 # <<<<<<<<<<<<<<
@@ -47324,34 +50197,66 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":814
+ /* "cdec/sa/rulefactory.pxi":814
* offset_by_one = 0
*
* len_last = len(suffix.getchunk(suffix.arity())) # <<<<<<<<<<<<<<
*
* if prefix_loc.arr is None:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_suffix), __pyx_n_s_getchunk); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_suffix), __pyx_n_s_arity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_suffix), __pyx_n_s_getchunk); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_suffix), __pyx_n_s_arity); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (__pyx_t_7) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else {
+ __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_6) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ }
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_v_len_last = __pyx_t_6;
+ __pyx_v_len_last = __pyx_t_8;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":816
+ /* "cdec/sa/rulefactory.pxi":816
* len_last = len(suffix.getchunk(suffix.arity()))
*
* if prefix_loc.arr is None: # <<<<<<<<<<<<<<
@@ -47359,37 +50264,37 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
* arr1 = prefix_loc.arr
*/
__pyx_t_3 = (((PyObject *)__pyx_v_prefix_loc->arr) == Py_None);
- __pyx_t_7 = (__pyx_t_3 != 0);
- if (__pyx_t_7) {
+ __pyx_t_9 = (__pyx_t_3 != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":817
+ /* "cdec/sa/rulefactory.pxi":817
*
* if prefix_loc.arr is None:
* self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) # <<<<<<<<<<<<<<
* arr1 = prefix_loc.arr
* low1 = prefix_loc.arr_low
*/
- __pyx_t_5 = ((PyObject *)__pyx_v_self->fsa->sa);
- __Pyx_INCREF(__pyx_t_5);
- ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5), __pyx_v_prefix_loc, __pyx_v_prefix);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->fsa->sa);
+ __Pyx_INCREF(__pyx_t_1);
+ ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1), __pyx_v_prefix_loc, __pyx_v_prefix);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L4;
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":818
+ /* "cdec/sa/rulefactory.pxi":818
* if prefix_loc.arr is None:
* self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix)
* arr1 = prefix_loc.arr # <<<<<<<<<<<<<<
* low1 = prefix_loc.arr_low
* high1 = prefix_loc.arr_high
*/
- __pyx_t_5 = ((PyObject *)__pyx_v_prefix_loc->arr);
- __Pyx_INCREF(__pyx_t_5);
- __pyx_v_arr1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_t_1 = ((PyObject *)__pyx_v_prefix_loc->arr);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_arr1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":819
+ /* "cdec/sa/rulefactory.pxi":819
* self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix)
* arr1 = prefix_loc.arr
* low1 = prefix_loc.arr_low # <<<<<<<<<<<<<<
@@ -47399,7 +50304,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_prefix_loc->arr_low;
__pyx_v_low1 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":820
+ /* "cdec/sa/rulefactory.pxi":820
* arr1 = prefix_loc.arr
* low1 = prefix_loc.arr_low
* high1 = prefix_loc.arr_high # <<<<<<<<<<<<<<
@@ -47409,7 +50314,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_prefix_loc->arr_high;
__pyx_v_high1 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":821
+ /* "cdec/sa/rulefactory.pxi":821
* low1 = prefix_loc.arr_low
* high1 = prefix_loc.arr_high
* step1 = prefix_loc.num_subpatterns # <<<<<<<<<<<<<<
@@ -47419,45 +50324,45 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_prefix_loc->num_subpatterns;
__pyx_v_step1 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":823
+ /* "cdec/sa/rulefactory.pxi":823
* step1 = prefix_loc.num_subpatterns
*
* if suffix_loc.arr is None: # <<<<<<<<<<<<<<
* self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix)
* arr2 = suffix_loc.arr
*/
- __pyx_t_7 = (((PyObject *)__pyx_v_suffix_loc->arr) == Py_None);
- __pyx_t_3 = (__pyx_t_7 != 0);
+ __pyx_t_9 = (((PyObject *)__pyx_v_suffix_loc->arr) == Py_None);
+ __pyx_t_3 = (__pyx_t_9 != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":824
+ /* "cdec/sa/rulefactory.pxi":824
*
* if suffix_loc.arr is None:
* self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) # <<<<<<<<<<<<<<
* arr2 = suffix_loc.arr
* low2 = suffix_loc.arr_low
*/
- __pyx_t_5 = ((PyObject *)__pyx_v_self->fsa->sa);
- __Pyx_INCREF(__pyx_t_5);
- ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5), __pyx_v_suffix_loc, __pyx_v_suffix);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = ((PyObject *)__pyx_v_self->fsa->sa);
+ __Pyx_INCREF(__pyx_t_1);
+ ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1), __pyx_v_suffix_loc, __pyx_v_suffix);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5;
}
__pyx_L5:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":825
+ /* "cdec/sa/rulefactory.pxi":825
* if suffix_loc.arr is None:
* self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix)
* arr2 = suffix_loc.arr # <<<<<<<<<<<<<<
* low2 = suffix_loc.arr_low
* high2 = suffix_loc.arr_high
*/
- __pyx_t_5 = ((PyObject *)__pyx_v_suffix_loc->arr);
- __Pyx_INCREF(__pyx_t_5);
- __pyx_v_arr2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_t_1 = ((PyObject *)__pyx_v_suffix_loc->arr);
+ __Pyx_INCREF(__pyx_t_1);
+ __pyx_v_arr2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":826
+ /* "cdec/sa/rulefactory.pxi":826
* self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix)
* arr2 = suffix_loc.arr
* low2 = suffix_loc.arr_low # <<<<<<<<<<<<<<
@@ -47467,7 +50372,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_suffix_loc->arr_low;
__pyx_v_low2 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":827
+ /* "cdec/sa/rulefactory.pxi":827
* arr2 = suffix_loc.arr
* low2 = suffix_loc.arr_low
* high2 = suffix_loc.arr_high # <<<<<<<<<<<<<<
@@ -47477,7 +50382,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_suffix_loc->arr_high;
__pyx_v_high2 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":828
+ /* "cdec/sa/rulefactory.pxi":828
* low2 = suffix_loc.arr_low
* high2 = suffix_loc.arr_high
* step2 = suffix_loc.num_subpatterns # <<<<<<<<<<<<<<
@@ -47487,26 +50392,41 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_2 = __pyx_v_suffix_loc->num_subpatterns;
__pyx_v_step2 = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":830
+ /* "cdec/sa/rulefactory.pxi":830
* step2 = suffix_loc.num_subpatterns
*
* num_subpatterns = prefix.arity()+1 # <<<<<<<<<<<<<<
*
* if algorithm == MERGE:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_prefix), __pyx_n_s_arity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_prefix), __pyx_n_s_arity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_7) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_num_subpatterns = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":832
+ /* "cdec/sa/rulefactory.pxi":832
* num_subpatterns = prefix.arity()+1
*
* if algorithm == MERGE: # <<<<<<<<<<<<<<
@@ -47516,7 +50436,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_3 = ((__pyx_v_algorithm == __pyx_v_4cdec_2sa_3_sa_MERGE) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":833
+ /* "cdec/sa/rulefactory.pxi":833
*
* if algorithm == MERGE:
* result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, # <<<<<<<<<<<<<<
@@ -47528,7 +50448,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":837
+ /* "cdec/sa/rulefactory.pxi":837
* offset_by_one, len_last, num_subpatterns, &result_len)
* else:
* result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, # <<<<<<<<<<<<<<
@@ -47539,7 +50459,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":841
+ /* "cdec/sa/rulefactory.pxi":841
* offset_by_one, len_last, num_subpatterns, &result_len)
*
* if result_len == 0: # <<<<<<<<<<<<<<
@@ -47549,7 +50469,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__pyx_t_3 = ((__pyx_v_result_len == 0) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":842
+ /* "cdec/sa/rulefactory.pxi":842
*
* if result_len == 0:
* free(result_ptr) # <<<<<<<<<<<<<<
@@ -47558,7 +50478,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
free(__pyx_v_result_ptr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":843
+ /* "cdec/sa/rulefactory.pxi":843
* if result_len == 0:
* free(result_ptr)
* return None # <<<<<<<<<<<<<<
@@ -47572,19 +50492,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":845
+ /* "cdec/sa/rulefactory.pxi":845
* return None
* else:
* result = IntList() # <<<<<<<<<<<<<<
* free(result.arr)
* result.arr = result_ptr
*/
- __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5);
- __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":846
+ /* "cdec/sa/rulefactory.pxi":846
* else:
* result = IntList()
* free(result.arr) # <<<<<<<<<<<<<<
@@ -47593,7 +50513,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
free(__pyx_v_result->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":847
+ /* "cdec/sa/rulefactory.pxi":847
* result = IntList()
* free(result.arr)
* result.arr = result_ptr # <<<<<<<<<<<<<<
@@ -47602,7 +50522,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
__pyx_v_result->arr = __pyx_v_result_ptr;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":848
+ /* "cdec/sa/rulefactory.pxi":848
* free(result.arr)
* result.arr = result_ptr
* result.len = result_len # <<<<<<<<<<<<<<
@@ -47611,7 +50531,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
__pyx_v_result->len = __pyx_v_result_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":849
+ /* "cdec/sa/rulefactory.pxi":849
* result.arr = result_ptr
* result.len = result_len
* result.size = result_len # <<<<<<<<<<<<<<
@@ -47620,7 +50540,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
*/
__pyx_v_result->size = __pyx_v_result_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":850
+ /* "cdec/sa/rulefactory.pxi":850
* result.len = result_len
* result.size = result_len
* return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) # <<<<<<<<<<<<<<
@@ -47628,27 +50548,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
* cdef loc2str(self, PhraseLocation loc):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_arr_low, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_result_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_arr_high, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_arr, ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_num_subpatterns, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_arr_low, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_result_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_arr_high, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_arr, ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_num_subpatterns, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":800
+ /* "cdec/sa/rulefactory.pxi":800
*
*
* cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<<
@@ -47661,6 +50581,8 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -47672,7 +50594,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_help
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":852
+/* "cdec/sa/rulefactory.pxi":852
* return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns)
*
* cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<<
@@ -47695,7 +50617,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("loc2str", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":854
+ /* "cdec/sa/rulefactory.pxi":854
* cdef loc2str(self, PhraseLocation loc):
* cdef int i, j
* result = "{" # <<<<<<<<<<<<<<
@@ -47705,7 +50627,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__Pyx_INCREF(__pyx_kp_s__63);
__pyx_v_result = __pyx_kp_s__63;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":855
+ /* "cdec/sa/rulefactory.pxi":855
* cdef int i, j
* result = "{"
* i = 0 # <<<<<<<<<<<<<<
@@ -47714,7 +50636,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
*/
__pyx_v_i = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":856
+ /* "cdec/sa/rulefactory.pxi":856
* result = "{"
* i = 0
* while i < loc.arr_high: # <<<<<<<<<<<<<<
@@ -47725,7 +50647,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__pyx_t_1 = ((__pyx_v_i < __pyx_v_loc->arr_high) != 0);
if (!__pyx_t_1) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":857
+ /* "cdec/sa/rulefactory.pxi":857
* i = 0
* while i < loc.arr_high:
* result = result + "(" # <<<<<<<<<<<<<<
@@ -47737,7 +50659,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":858
+ /* "cdec/sa/rulefactory.pxi":858
* while i < loc.arr_high:
* result = result + "("
* for j from i <= j < i + loc.num_subpatterns: # <<<<<<<<<<<<<<
@@ -47747,7 +50669,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__pyx_t_3 = (__pyx_v_i + __pyx_v_loc->num_subpatterns);
for (__pyx_v_j = __pyx_v_i; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":859
+ /* "cdec/sa/rulefactory.pxi":859
* result = result + "("
* for j from i <= j < i + loc.num_subpatterns:
* result = result + ("%d " %loc.arr[j]) # <<<<<<<<<<<<<<
@@ -47766,7 +50688,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":860
+ /* "cdec/sa/rulefactory.pxi":860
* for j from i <= j < i + loc.num_subpatterns:
* result = result + ("%d " %loc.arr[j])
* result = result + ")" # <<<<<<<<<<<<<<
@@ -47778,7 +50700,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":861
+ /* "cdec/sa/rulefactory.pxi":861
* result = result + ("%d " %loc.arr[j])
* result = result + ")"
* i = i + loc.num_subpatterns # <<<<<<<<<<<<<<
@@ -47788,7 +50710,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__pyx_v_i = (__pyx_v_i + __pyx_v_loc->num_subpatterns);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":862
+ /* "cdec/sa/rulefactory.pxi":862
* result = result + ")"
* i = i + loc.num_subpatterns
* result = result + "}" # <<<<<<<<<<<<<<
@@ -47800,7 +50722,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":863
+ /* "cdec/sa/rulefactory.pxi":863
* i = i + loc.num_subpatterns
* result = result + "}"
* return result # <<<<<<<<<<<<<<
@@ -47812,7 +50734,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":852
+ /* "cdec/sa/rulefactory.pxi":852
* return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns)
*
* cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<<
@@ -47833,7 +50755,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":865
+/* "cdec/sa/rulefactory.pxi":865
* return result
*
* cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<<
@@ -47853,14 +50775,15 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
+ int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("intersect", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":869
+ /* "cdec/sa/rulefactory.pxi":869
* cdef PhraseLocation prefix_loc, suffix_loc, result
*
* prefix = prefix_node.phrase # <<<<<<<<<<<<<<
@@ -47873,7 +50796,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__pyx_v_prefix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":870
+ /* "cdec/sa/rulefactory.pxi":870
*
* prefix = prefix_node.phrase
* suffix = suffix_node.phrase # <<<<<<<<<<<<<<
@@ -47886,7 +50809,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__pyx_v_suffix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":871
+ /* "cdec/sa/rulefactory.pxi":871
* prefix = prefix_node.phrase
* suffix = suffix_node.phrase
* prefix_loc = prefix_node.phrase_location # <<<<<<<<<<<<<<
@@ -47899,7 +50822,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__pyx_v_prefix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":872
+ /* "cdec/sa/rulefactory.pxi":872
* suffix = suffix_node.phrase
* prefix_loc = prefix_node.phrase_location
* suffix_loc = suffix_node.phrase_location # <<<<<<<<<<<<<<
@@ -47912,40 +50835,56 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__pyx_v_suffix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":874
+ /* "cdec/sa/rulefactory.pxi":874
* suffix_loc = suffix_node.phrase_location
*
* result = self.get_precomputed_collocation(phrase) # <<<<<<<<<<<<<<
* if result is not None:
* intersect_method = "precomputed"
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_precomputed_collocation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_precomputed_collocation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)__pyx_v_phrase));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_phrase));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_phrase));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_phrase)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_phrase));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_phrase));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_phrase));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3);
- __pyx_t_3 = 0;
+ if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":875
+ /* "cdec/sa/rulefactory.pxi":875
*
* result = self.get_precomputed_collocation(phrase)
* if result is not None: # <<<<<<<<<<<<<<
* intersect_method = "precomputed"
*
*/
- __pyx_t_4 = (((PyObject *)__pyx_v_result) != Py_None);
- __pyx_t_5 = (__pyx_t_4 != 0);
- if (__pyx_t_5) {
+ __pyx_t_5 = (((PyObject *)__pyx_v_result) != Py_None);
+ __pyx_t_6 = (__pyx_t_5 != 0);
+ if (__pyx_t_6) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":876
+ /* "cdec/sa/rulefactory.pxi":876
* result = self.get_precomputed_collocation(phrase)
* if result is not None:
* intersect_method = "precomputed" # <<<<<<<<<<<<<<
@@ -47958,41 +50897,41 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":878
+ /* "cdec/sa/rulefactory.pxi":878
* intersect_method = "precomputed"
*
* if result is None: # <<<<<<<<<<<<<<
* if self.use_baeza_yates:
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES)
*/
- __pyx_t_5 = (((PyObject *)__pyx_v_result) == Py_None);
- __pyx_t_4 = (__pyx_t_5 != 0);
- if (__pyx_t_4) {
+ __pyx_t_6 = (((PyObject *)__pyx_v_result) == Py_None);
+ __pyx_t_5 = (__pyx_t_6 != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":879
+ /* "cdec/sa/rulefactory.pxi":879
*
* if result is None:
* if self.use_baeza_yates: # <<<<<<<<<<<<<<
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES)
* intersect_method="double binary"
*/
- __pyx_t_4 = (__pyx_v_self->use_baeza_yates != 0);
- if (__pyx_t_4) {
+ __pyx_t_5 = (__pyx_v_self->use_baeza_yates != 0);
+ if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":880
+ /* "cdec/sa/rulefactory.pxi":880
* if result is None:
* if self.use_baeza_yates:
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) # <<<<<<<<<<<<<<
* intersect_method="double binary"
* else:
*/
- __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_BAEZA_YATES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3));
- __pyx_t_3 = 0;
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_BAEZA_YATES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1));
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":881
+ /* "cdec/sa/rulefactory.pxi":881
* if self.use_baeza_yates:
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES)
* intersect_method="double binary" # <<<<<<<<<<<<<<
@@ -48005,20 +50944,20 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":883
+ /* "cdec/sa/rulefactory.pxi":883
* intersect_method="double binary"
* else:
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) # <<<<<<<<<<<<<<
* intersect_method="merge"
* return result
*/
- __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_MERGE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3));
- __pyx_t_3 = 0;
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->intersect_helper(__pyx_v_self, __pyx_v_prefix, __pyx_v_suffix, __pyx_v_prefix_loc, __pyx_v_suffix_loc, __pyx_v_4cdec_2sa_3_sa_MERGE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF_SET(__pyx_v_result, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1));
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":884
+ /* "cdec/sa/rulefactory.pxi":884
* else:
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE)
* intersect_method="merge" # <<<<<<<<<<<<<<
@@ -48033,7 +50972,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":885
+ /* "cdec/sa/rulefactory.pxi":885
* result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE)
* intersect_method="merge"
* return result # <<<<<<<<<<<<<<
@@ -48045,7 +50984,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":865
+ /* "cdec/sa/rulefactory.pxi":865
* return result
*
* cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<<
@@ -48058,6 +50997,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -48072,7 +51012,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_f_4cdec_2sa_3_sa_23
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":887
+/* "cdec/sa/rulefactory.pxi":887
* return result
*
* def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<<
@@ -48176,14 +51116,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
int __pyx_t_13;
Py_ssize_t __pyx_t_14;
int __pyx_t_15;
- int __pyx_t_16;
- unsigned int __pyx_t_17;
+ unsigned int __pyx_t_16;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("advance", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":889
+ /* "cdec/sa/rulefactory.pxi":889
* def advance(self, frontier, res, fwords):
* cdef unsigned na
* nf = [] # <<<<<<<<<<<<<<
@@ -48195,36 +51134,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__pyx_v_nf = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":890
+ /* "cdec/sa/rulefactory.pxi":890
* cdef unsigned na
* nf = []
* for toskip, (i, alt, pathlen) in frontier: # <<<<<<<<<<<<<<
* spanlen = fwords[i][alt][2]
* if toskip == 0:
*/
- if (PyList_CheckExact(__pyx_v_frontier) || PyTuple_CheckExact(__pyx_v_frontier)) {
+ if (likely(PyList_CheckExact(__pyx_v_frontier)) || PyTuple_CheckExact(__pyx_v_frontier)) {
__pyx_t_1 = __pyx_v_frontier; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_frontier); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -48353,7 +51294,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_XDECREF_SET(__pyx_v_pathlen, __pyx_t_10);
__pyx_t_10 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":891
+ /* "cdec/sa/rulefactory.pxi":891
* nf = []
* for toskip, (i, alt, pathlen) in frontier:
* spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<<
@@ -48371,7 +51312,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_XDECREF_SET(__pyx_v_spanlen, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":892
+ /* "cdec/sa/rulefactory.pxi":892
* for toskip, (i, alt, pathlen) in frontier:
* spanlen = fwords[i][alt][2]
* if toskip == 0: # <<<<<<<<<<<<<<
@@ -48383,7 +51324,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":893
+ /* "cdec/sa/rulefactory.pxi":893
* spanlen = fwords[i][alt][2]
* if toskip == 0:
* res.append((i, alt, pathlen)) # <<<<<<<<<<<<<<
@@ -48407,7 +51348,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
}
__pyx_L9:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":894
+ /* "cdec/sa/rulefactory.pxi":894
* if toskip == 0:
* res.append((i, alt, pathlen))
* ni = i + spanlen # <<<<<<<<<<<<<<
@@ -48419,7 +51360,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_XDECREF_SET(__pyx_v_ni, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":895
+ /* "cdec/sa/rulefactory.pxi":895
* res.append((i, alt, pathlen))
* ni = i + spanlen
* if ni < len(fwords) and pathlen + 1 < self.max_initial_size: # <<<<<<<<<<<<<<
@@ -48431,25 +51372,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (__pyx_t_12) {
- __pyx_t_6 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_16 = __pyx_t_15;
+ if (__pyx_t_15) {
+ goto __pyx_L12_next_and;
} else {
- __pyx_t_16 = __pyx_t_12;
+ __pyx_t_12 = __pyx_t_15;
+ goto __pyx_L11_bool_binop_done;
}
- if (__pyx_t_16) {
+ __pyx_L12_next_and:;
+ __pyx_t_6 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_12 = __pyx_t_15;
+ __pyx_L11_bool_binop_done:;
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":896
+ /* "cdec/sa/rulefactory.pxi":896
* ni = i + spanlen
* if ni < len(fwords) and pathlen + 1 < self.max_initial_size:
* for na in range(len(fwords[ni])): # <<<<<<<<<<<<<<
@@ -48460,10 +51405,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_14 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_14; __pyx_t_17+=1) {
- __pyx_v_na = __pyx_t_17;
+ for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) {
+ __pyx_v_na = __pyx_t_16;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":897
+ /* "cdec/sa/rulefactory.pxi":897
* if ni < len(fwords) and pathlen + 1 < self.max_initial_size:
* for na in range(len(fwords[ni])):
* nf.append((toskip - 1, (ni, na, pathlen + 1))) # <<<<<<<<<<<<<<
@@ -48501,10 +51446,18 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
goto __pyx_L10;
}
__pyx_L10:;
+
+ /* "cdec/sa/rulefactory.pxi":890
+ * cdef unsigned na
+ * nf = []
+ * for toskip, (i, alt, pathlen) in frontier: # <<<<<<<<<<<<<<
+ * spanlen = fwords[i][alt][2]
+ * if toskip == 0:
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":898
+ /* "cdec/sa/rulefactory.pxi":898
* for na in range(len(fwords[ni])):
* nf.append((toskip - 1, (ni, na, pathlen + 1)))
* if len(nf) > 0: # <<<<<<<<<<<<<<
@@ -48512,10 +51465,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
* else:
*/
__pyx_t_2 = PyList_GET_SIZE(__pyx_v_nf); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_16 = ((__pyx_t_2 > 0) != 0);
- if (__pyx_t_16) {
+ __pyx_t_12 = ((__pyx_t_2 > 0) != 0);
+ if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":899
+ /* "cdec/sa/rulefactory.pxi":899
* nf.append((toskip - 1, (ni, na, pathlen + 1)))
* if len(nf) > 0:
* return self.advance(nf, res, fwords) # <<<<<<<<<<<<<<
@@ -48523,30 +51476,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
* return res
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_advance); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_advance); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_10 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_10) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL;
+ }
__Pyx_INCREF(__pyx_v_nf);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_nf);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_2, __pyx_v_nf);
__Pyx_GIVEREF(__pyx_v_nf);
__Pyx_INCREF(__pyx_v_res);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_res);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_2, __pyx_v_res);
__Pyx_GIVEREF(__pyx_v_res);
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_2, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_10;
- __pyx_t_10 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":901
+ /* "cdec/sa/rulefactory.pxi":901
* return self.advance(nf, res, fwords)
* else:
* return res # <<<<<<<<<<<<<<
@@ -48559,7 +51527,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":887
+ /* "cdec/sa/rulefactory.pxi":887
* return result
*
* def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<<
@@ -48592,7 +51560,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(str
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":903
+/* "cdec/sa/rulefactory.pxi":903
* return res
*
* def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<<
@@ -48723,20 +51691,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
- PyObject *(*__pyx_t_7)(PyObject *);
- Py_ssize_t __pyx_t_8;
- PyObject *(*__pyx_t_9)(PyObject *);
- PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *(*__pyx_t_8)(PyObject *);
+ Py_ssize_t __pyx_t_9;
+ PyObject *(*__pyx_t_10)(PyObject *);
PyObject *__pyx_t_11 = NULL;
Py_ssize_t __pyx_t_12;
- Py_ssize_t __pyx_t_13;
- int __pyx_t_14;
+ PyObject *__pyx_t_13 = NULL;
+ Py_ssize_t __pyx_t_14;
+ int __pyx_t_15;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_all_nodes_isteps_away", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":905
+ /* "cdec/sa/rulefactory.pxi":905
* def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer):
* cdef unsigned alt_it
* frontier = [] # <<<<<<<<<<<<<<
@@ -48748,7 +51717,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_v_frontier = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":906
+ /* "cdec/sa/rulefactory.pxi":906
* cdef unsigned alt_it
* frontier = []
* if i+spanlen+skip >= len(next_states): # <<<<<<<<<<<<<<
@@ -48770,7 +51739,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":907
+ /* "cdec/sa/rulefactory.pxi":907
* frontier = []
* if i+spanlen+skip >= len(next_states):
* return frontier # <<<<<<<<<<<<<<
@@ -48783,7 +51752,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":908
+ /* "cdec/sa/rulefactory.pxi":908
* if i+spanlen+skip >= len(next_states):
* return frontier
* key = tuple([i,spanlen]) # <<<<<<<<<<<<<<
@@ -48804,7 +51773,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_v_key = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":909
+ /* "cdec/sa/rulefactory.pxi":909
* return frontier
* key = tuple([i,spanlen])
* reachable = [] # <<<<<<<<<<<<<<
@@ -48816,7 +51785,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_v_reachable = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":910
+ /* "cdec/sa/rulefactory.pxi":910
* key = tuple([i,spanlen])
* reachable = []
* if key in reachable_buffer: # <<<<<<<<<<<<<<
@@ -48827,7 +51796,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_t_6 = (__pyx_t_5 != 0);
if (__pyx_t_6) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":911
+ /* "cdec/sa/rulefactory.pxi":911
* reachable = []
* if key in reachable_buffer:
* reachable = reachable_buffer[key] # <<<<<<<<<<<<<<
@@ -48842,34 +51811,49 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":913
+ /* "cdec/sa/rulefactory.pxi":913
* reachable = reachable_buffer[key]
* else:
* reachable = self.reachable(fwords, i, spanlen) # <<<<<<<<<<<<<<
* reachable_buffer[key] = reachable
* for nextreachable in reachable:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = NULL;
+ __pyx_t_3 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_3 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(3+__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_2) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_3, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
__Pyx_INCREF(__pyx_v_i);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_i);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_3, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_spanlen);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_spanlen);
+ PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_3, __pyx_v_spanlen);
__Pyx_GIVEREF(__pyx_v_spanlen);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __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_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF_SET(__pyx_v_reachable, __pyx_t_2);
- __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_reachable, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":914
+ /* "cdec/sa/rulefactory.pxi":914
* else:
* reachable = self.reachable(fwords, i, spanlen)
* reachable_buffer[key] = reachable # <<<<<<<<<<<<<<
@@ -48880,38 +51864,40 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
}
__pyx_L4:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":915
+ /* "cdec/sa/rulefactory.pxi":915
* reachable = self.reachable(fwords, i, spanlen)
* reachable_buffer[key] = reachable
* for nextreachable in reachable: # <<<<<<<<<<<<<<
* for next_id in next_states[nextreachable]:
* jump = self.shortest(fwords,i,next_id)
*/
- if (PyList_CheckExact(__pyx_v_reachable) || PyTuple_CheckExact(__pyx_v_reachable)) {
- __pyx_t_2 = __pyx_v_reachable; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
- __pyx_t_7 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_reachable)) || PyTuple_CheckExact(__pyx_v_reachable)) {
+ __pyx_t_1 = __pyx_v_reachable; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
+ __pyx_t_8 = NULL;
} else {
- __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_reachable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_8)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_7(__pyx_t_2);
+ __pyx_t_4 = __pyx_t_8(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -48925,7 +51911,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__Pyx_XDECREF_SET(__pyx_v_nextreachable, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":916
+ /* "cdec/sa/rulefactory.pxi":916
* reachable_buffer[key] = reachable
* for nextreachable in reachable:
* for next_id in next_states[nextreachable]: # <<<<<<<<<<<<<<
@@ -48934,32 +51920,34 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
*/
__pyx_t_4 = PyObject_GetItem(__pyx_v_next_states, __pyx_v_nextreachable); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
- __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
- __pyx_t_9 = NULL;
+ if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_7 = __pyx_t_4; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
+ __pyx_t_10 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_10)) {
+ if (likely(PyList_CheckExact(__pyx_t_7))) {
+ if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_4 = __pyx_t_9(__pyx_t_1);
+ __pyx_t_4 = __pyx_t_10(__pyx_t_7);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
@@ -48973,46 +51961,61 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__Pyx_XDECREF_SET(__pyx_v_next_id, __pyx_t_4);
__pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":917
+ /* "cdec/sa/rulefactory.pxi":917
* for nextreachable in reachable:
* for next_id in next_states[nextreachable]:
* jump = self.shortest(fwords,i,next_id) # <<<<<<<<<<<<<<
* if jump < skip:
* continue
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shortest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shortest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_11 = NULL;
+ __pyx_t_12 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_12 = 1;
+ }
+ }
+ __pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ if (__pyx_t_11) {
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
__Pyx_INCREF(__pyx_v_i);
- PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_i);
+ PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_next_id);
- PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_next_id);
+ PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_v_next_id);
__Pyx_GIVEREF(__pyx_v_next_id);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_XDECREF_SET(__pyx_v_jump, __pyx_t_11);
- __pyx_t_11 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_jump, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":918
+ /* "cdec/sa/rulefactory.pxi":918
* for next_id in next_states[nextreachable]:
* jump = self.shortest(fwords,i,next_id)
* if jump < skip: # <<<<<<<<<<<<<<
* continue
* if pathlen+jump <= self.max_initial_size:
*/
- __pyx_t_11 = PyObject_RichCompare(__pyx_v_jump, __pyx_v_skip, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_4 = PyObject_RichCompare(__pyx_v_jump, __pyx_v_skip, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_6) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":919
+ /* "cdec/sa/rulefactory.pxi":919
* jump = self.shortest(fwords,i,next_id)
* if jump < skip:
* continue # <<<<<<<<<<<<<<
@@ -49022,88 +52025,88 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
goto __pyx_L7_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":920
+ /* "cdec/sa/rulefactory.pxi":920
* if jump < skip:
* continue
* if pathlen+jump <= self.max_initial_size: # <<<<<<<<<<<<<<
* for alt_id in range(len(fwords[next_id])):
* if fwords[next_id][alt_id][0] != EPSILON:
*/
- __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_11, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
if (__pyx_t_6) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":921
+ /* "cdec/sa/rulefactory.pxi":921
* continue
* if pathlen+jump <= self.max_initial_size:
* for alt_id in range(len(fwords[next_id])): # <<<<<<<<<<<<<<
* if fwords[next_id][alt_id][0] != EPSILON:
* newel = (next_id,alt_id,pathlen+jump)
*/
- __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_12 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
- __pyx_v_alt_id = __pyx_t_13;
+ __pyx_t_13 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_12 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) {
+ __pyx_v_alt_id = __pyx_t_14;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":922
+ /* "cdec/sa/rulefactory.pxi":922
* if pathlen+jump <= self.max_initial_size:
* for alt_id in range(len(fwords[next_id])):
* if fwords[next_id][alt_id][0] != EPSILON: # <<<<<<<<<<<<<<
* newel = (next_id,alt_id,pathlen+jump)
* if newel not in frontier:
*/
- __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = PyObject_RichCompare(__pyx_t_4, __pyx_t_10, Py_NE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_13, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __pyx_t_13 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_13, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (__pyx_t_6) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":923
+ /* "cdec/sa/rulefactory.pxi":923
* for alt_id in range(len(fwords[next_id])):
* if fwords[next_id][alt_id][0] != EPSILON:
* newel = (next_id,alt_id,pathlen+jump) # <<<<<<<<<<<<<<
* if newel not in frontier:
* frontier.append((next_id,alt_id,pathlen+jump))
*/
- __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
__Pyx_INCREF(__pyx_v_next_id);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_next_id);
+ PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_next_id);
__Pyx_GIVEREF(__pyx_v_next_id);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_11 = 0;
- __pyx_t_10 = 0;
- __Pyx_XDECREF_SET(__pyx_v_newel, ((PyObject*)__pyx_t_4));
+ PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
__pyx_t_4 = 0;
+ __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_newel, ((PyObject*)__pyx_t_13));
+ __pyx_t_13 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":924
+ /* "cdec/sa/rulefactory.pxi":924
* if fwords[next_id][alt_id][0] != EPSILON:
* newel = (next_id,alt_id,pathlen+jump)
* if newel not in frontier: # <<<<<<<<<<<<<<
@@ -49114,30 +52117,30 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_t_5 = (__pyx_t_6 != 0);
if (__pyx_t_5) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":925
+ /* "cdec/sa/rulefactory.pxi":925
* newel = (next_id,alt_id,pathlen+jump)
* if newel not in frontier:
* frontier.append((next_id,alt_id,pathlen+jump)) # <<<<<<<<<<<<<<
* return frontier
*
*/
- __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_alt_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __pyx_t_2 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_v_next_id);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_next_id);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_next_id);
__Pyx_GIVEREF(__pyx_v_next_id);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_4 = 0;
- __pyx_t_10 = 0;
- __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_frontier, __pyx_t_11); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_13);
+ __Pyx_GIVEREF(__pyx_t_13);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __pyx_t_13 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_frontier, __pyx_t_4); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L14;
}
__pyx_L14:;
@@ -49148,13 +52151,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
goto __pyx_L10;
}
__pyx_L10:;
+
+ /* "cdec/sa/rulefactory.pxi":916
+ * reachable_buffer[key] = reachable
+ * for nextreachable in reachable:
+ * for next_id in next_states[nextreachable]: # <<<<<<<<<<<<<<
+ * jump = self.shortest(fwords,i,next_id)
+ * if jump < skip:
+ */
__pyx_L7_continue:;
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":915
+ * reachable = self.reachable(fwords, i, spanlen)
+ * reachable_buffer[key] = reachable
+ * for nextreachable in reachable: # <<<<<<<<<<<<<<
+ * for next_id in next_states[nextreachable]:
+ * jump = self.shortest(fwords,i,next_id)
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":926
+ /* "cdec/sa/rulefactory.pxi":926
* if newel not in frontier:
* frontier.append((next_id,alt_id,pathlen+jump))
* return frontier # <<<<<<<<<<<<<<
@@ -49166,7 +52185,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__pyx_r = __pyx_v_frontier;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":903
+ /* "cdec/sa/rulefactory.pxi":903
* return res
*
* def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<<
@@ -49179,8 +52198,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_10);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -49196,7 +52216,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nod
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":928
+/* "cdec/sa/rulefactory.pxi":928
* return frontier
*
* def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<<
@@ -49286,17 +52306,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
int __pyx_t_4;
Py_ssize_t __pyx_t_5;
PyObject *__pyx_t_6 = NULL;
- int __pyx_t_7;
- int __pyx_t_8;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
- Py_ssize_t __pyx_t_10;
- PyObject *(*__pyx_t_11)(PyObject *);
+ int __pyx_t_10;
+ int __pyx_t_11;
+ PyObject *__pyx_t_12 = NULL;
+ PyObject *(*__pyx_t_13)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("reachable", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":929
+ /* "cdec/sa/rulefactory.pxi":929
*
* def reachable(self, fwords, ifrom, dist):
* ret = [] # <<<<<<<<<<<<<<
@@ -49308,7 +52330,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
__pyx_v_ret = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":930
+ /* "cdec/sa/rulefactory.pxi":930
* def reachable(self, fwords, ifrom, dist):
* ret = []
* if ifrom >= len(fwords): # <<<<<<<<<<<<<<
@@ -49324,7 +52346,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":931
+ /* "cdec/sa/rulefactory.pxi":931
* ret = []
* if ifrom >= len(fwords):
* return ret # <<<<<<<<<<<<<<
@@ -49337,7 +52359,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":932
+ /* "cdec/sa/rulefactory.pxi":932
* if ifrom >= len(fwords):
* return ret
* for alt_id in range(len(fwords[ifrom])): # <<<<<<<<<<<<<<
@@ -49351,7 +52373,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
__pyx_v_alt_id = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":933
+ /* "cdec/sa/rulefactory.pxi":933
* return ret
* for alt_id in range(len(fwords[ifrom])):
* if fwords[ifrom][alt_id][0] == EPSILON: # <<<<<<<<<<<<<<
@@ -49375,60 +52397,75 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":934
+ /* "cdec/sa/rulefactory.pxi":934
* for alt_id in range(len(fwords[ifrom])):
* if fwords[ifrom][alt_id][0] == EPSILON:
* ret.extend(self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist)) # <<<<<<<<<<<<<<
* else:
* if dist == 0:
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_dist);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_dist);
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_dist);
__Pyx_GIVEREF(__pyx_v_dist);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_7 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_7 = __Pyx_PyList_Extend(__pyx_v_ret, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_ret, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L6;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":936
+ /* "cdec/sa/rulefactory.pxi":936
* ret.extend(self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist))
* else:
* if dist == 0: # <<<<<<<<<<<<<<
* if ifrom not in ret:
* ret.append(ifrom)
*/
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_6 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":937
+ /* "cdec/sa/rulefactory.pxi":937
* else:
* if dist == 0:
* if ifrom not in ret: # <<<<<<<<<<<<<<
@@ -49436,17 +52473,17 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
* else:
*/
__pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, __pyx_v_ret, Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_8 = (__pyx_t_4 != 0);
- if (__pyx_t_8) {
+ __pyx_t_11 = (__pyx_t_4 != 0);
+ if (__pyx_t_11) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":938
+ /* "cdec/sa/rulefactory.pxi":938
* if dist == 0:
* if ifrom not in ret:
* ret.append(ifrom) # <<<<<<<<<<<<<<
* else:
* for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1):
*/
- __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
@@ -49454,70 +52491,87 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":940
+ /* "cdec/sa/rulefactory.pxi":940
* ret.append(ifrom)
* else:
* for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): # <<<<<<<<<<<<<<
* if ifromchild not in ret:
* ret.append(ifromchild)
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reachable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_6, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_alt_id, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_7, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __pyx_t_9 = PyNumber_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
+ __pyx_t_3 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_12 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_8, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
- PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_6 = 0;
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
- __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0;
- __pyx_t_11 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_8, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_8, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
+ __pyx_t_7 = 0;
+ __pyx_t_9 = 0;
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
+ __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
+ __pyx_t_13 = NULL;
} else {
- __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_9);
- __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext;
+ __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_9)) {
- if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) {
- if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_13)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_11(__pyx_t_9);
- if (unlikely(!__pyx_t_1)) {
+ __pyx_t_6 = __pyx_t_13(__pyx_t_1);
+ if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -49525,42 +52579,50 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
}
break;
}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_6);
}
- __Pyx_XDECREF_SET(__pyx_v_ifromchild, __pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_ifromchild, __pyx_t_6);
+ __pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":941
+ /* "cdec/sa/rulefactory.pxi":941
* else:
* for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1):
* if ifromchild not in ret: # <<<<<<<<<<<<<<
* ret.append(ifromchild)
*
*/
- __pyx_t_8 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, __pyx_v_ret, Py_NE)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = (__pyx_t_8 != 0);
+ __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, __pyx_v_ret, Py_NE)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = (__pyx_t_11 != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":942
+ /* "cdec/sa/rulefactory.pxi":942
* for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1):
* if ifromchild not in ret:
* ret.append(ifromchild) # <<<<<<<<<<<<<<
*
* return ret
*/
- __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L11;
}
__pyx_L11:;
+
+ /* "cdec/sa/rulefactory.pxi":940
+ * ret.append(ifrom)
+ * else:
+ * for ifromchild in self.reachable(fwords,ifrom+fwords[ifrom][alt_id][2],dist-1): # <<<<<<<<<<<<<<
+ * if ifromchild not in ret:
+ * ret.append(ifromchild)
+ */
}
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L7:;
}
__pyx_L6:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":944
+ /* "cdec/sa/rulefactory.pxi":944
* ret.append(ifromchild)
*
* return ret # <<<<<<<<<<<<<<
@@ -49572,7 +52634,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
__pyx_r = __pyx_v_ret;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":928
+ /* "cdec/sa/rulefactory.pxi":928
* return frontier
*
* def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<<
@@ -49585,7 +52647,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -49596,7 +52660,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":946
+/* "cdec/sa/rulefactory.pxi":946
* return ret
*
* def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<<
@@ -49686,12 +52750,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
unsigned int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ Py_ssize_t __pyx_t_8;
+ PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("shortest", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":948
+ /* "cdec/sa/rulefactory.pxi":948
* def shortest(self, fwords, ifrom, ito):
* cdef unsigned alt_id
* min = 1000 # <<<<<<<<<<<<<<
@@ -49701,7 +52768,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__Pyx_INCREF(__pyx_int_1000);
__pyx_v_min = __pyx_int_1000;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":949
+ /* "cdec/sa/rulefactory.pxi":949
* cdef unsigned alt_id
* min = 1000
* if ifrom > ito: # <<<<<<<<<<<<<<
@@ -49713,7 +52780,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":950
+ /* "cdec/sa/rulefactory.pxi":950
* min = 1000
* if ifrom > ito:
* return min # <<<<<<<<<<<<<<
@@ -49726,7 +52793,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":951
+ /* "cdec/sa/rulefactory.pxi":951
* if ifrom > ito:
* return min
* if ifrom == ito: # <<<<<<<<<<<<<<
@@ -49738,7 +52805,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":952
+ /* "cdec/sa/rulefactory.pxi":952
* return min
* if ifrom == ito:
* return 0 # <<<<<<<<<<<<<<
@@ -49751,7 +52818,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":953
+ /* "cdec/sa/rulefactory.pxi":953
* if ifrom == ito:
* return 0
* for alt_id in range(len(fwords[ifrom])): # <<<<<<<<<<<<<<
@@ -49765,96 +52832,111 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_alt_id = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":954
+ /* "cdec/sa/rulefactory.pxi":954
* return 0
* for alt_id in range(len(fwords[ifrom])):
* currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) # <<<<<<<<<<<<<<
* if fwords[ifrom][alt_id][0] != EPSILON:
* currmin += 1
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shortest); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shortest); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_alt_id, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ __pyx_t_8 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ if (__pyx_t_6) {
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_fwords);
__Pyx_GIVEREF(__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
- __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
__Pyx_INCREF(__pyx_v_ito);
- PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_ito);
+ PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_ito);
__Pyx_GIVEREF(__pyx_v_ito);
- __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_7 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF_SET(__pyx_v_currmin, __pyx_t_6);
- __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_currmin, __pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":955
+ /* "cdec/sa/rulefactory.pxi":955
* for alt_id in range(len(fwords[ifrom])):
* currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito)
* if fwords[ifrom][alt_id][0] != EPSILON: # <<<<<<<<<<<<<<
* currmin += 1
* if currmin < min:
*/
- __pyx_t_6 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_alt_id, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":956
+ /* "cdec/sa/rulefactory.pxi":956
* currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito)
* if fwords[ifrom][alt_id][0] != EPSILON:
* currmin += 1 # <<<<<<<<<<<<<<
* if currmin < min:
* min = currmin
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_currmin, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF_SET(__pyx_v_currmin, __pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_currmin, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF_SET(__pyx_v_currmin, __pyx_t_9);
+ __pyx_t_9 = 0;
goto __pyx_L7;
}
__pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":957
+ /* "cdec/sa/rulefactory.pxi":957
* if fwords[ifrom][alt_id][0] != EPSILON:
* currmin += 1
* if currmin < min: # <<<<<<<<<<<<<<
* min = currmin
* return min
*/
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_currmin, __pyx_v_min, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 957; __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[8]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = PyObject_RichCompare(__pyx_v_currmin, __pyx_v_min, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":958
+ /* "cdec/sa/rulefactory.pxi":958
* currmin += 1
* if currmin < min:
* min = currmin # <<<<<<<<<<<<<<
@@ -49868,7 +52950,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__pyx_L8:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":959
+ /* "cdec/sa/rulefactory.pxi":959
* if currmin < min:
* min = currmin
* return min # <<<<<<<<<<<<<<
@@ -49880,7 +52962,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__pyx_r = __pyx_v_min;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":946
+ /* "cdec/sa/rulefactory.pxi":946
* return ret
*
* def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<<
@@ -49893,6 +52975,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -49903,7 +52987,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(st
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":961
+/* "cdec/sa/rulefactory.pxi":961
* return min
*
* def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<<
@@ -50009,7 +53093,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_next_states", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":962
+ /* "cdec/sa/rulefactory.pxi":962
*
* def get_next_states(self, _columns, curr_idx, min_dist=2):
* result = [] # <<<<<<<<<<<<<<
@@ -50021,7 +53105,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_v_result = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":963
+ /* "cdec/sa/rulefactory.pxi":963
* def get_next_states(self, _columns, curr_idx, min_dist=2):
* result = []
* candidate = [[curr_idx,0]] # <<<<<<<<<<<<<<
@@ -50044,7 +53128,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_v_candidate = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":965
+ /* "cdec/sa/rulefactory.pxi":965
* candidate = [[curr_idx,0]]
*
* while len(candidate) > 0: # <<<<<<<<<<<<<<
@@ -50056,7 +53140,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_t_4 = ((__pyx_t_3 > 0) != 0);
if (!__pyx_t_4) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":966
+ /* "cdec/sa/rulefactory.pxi":966
*
* while len(candidate) > 0:
* curr = candidate.pop() # <<<<<<<<<<<<<<
@@ -50068,7 +53152,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_XDECREF_SET(__pyx_v_curr, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":967
+ /* "cdec/sa/rulefactory.pxi":967
* while len(candidate) > 0:
* curr = candidate.pop()
* if curr[0] >= len(_columns): # <<<<<<<<<<<<<<
@@ -50087,7 +53171,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":968
+ /* "cdec/sa/rulefactory.pxi":968
* curr = candidate.pop()
* if curr[0] >= len(_columns):
* continue # <<<<<<<<<<<<<<
@@ -50097,7 +53181,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
goto __pyx_L3_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":969
+ /* "cdec/sa/rulefactory.pxi":969
* if curr[0] >= len(_columns):
* continue
* if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: # <<<<<<<<<<<<<<
@@ -50106,29 +53190,34 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
*/
__pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = (__Pyx_PySequence_Contains(__pyx_t_5, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (__pyx_t_4) {
- __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
- __Pyx_DECREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- }
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_7 = __pyx_t_6;
+ __pyx_t_7 = (__pyx_t_6 != 0);
+ if (__pyx_t_7) {
+ goto __pyx_L8_next_and;
} else {
- __pyx_t_7 = __pyx_t_4;
+ __pyx_t_4 = __pyx_t_7;
+ goto __pyx_L7_bool_binop_done;
}
- if (__pyx_t_7) {
+ __pyx_L8_next_and:;
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = __pyx_t_7;
+ __pyx_L7_bool_binop_done:;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":970
+ /* "cdec/sa/rulefactory.pxi":970
* continue
* if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size:
* result.append(curr[0]); # <<<<<<<<<<<<<<
@@ -50143,7 +53232,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":971
+ /* "cdec/sa/rulefactory.pxi":971
* if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size:
* result.append(curr[0]);
* curr_col = _columns[curr[0]] # <<<<<<<<<<<<<<
@@ -50158,36 +53247,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_XDECREF_SET(__pyx_v_curr_col, __pyx_t_5);
__pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":972
+ /* "cdec/sa/rulefactory.pxi":972
* result.append(curr[0]);
* curr_col = _columns[curr[0]]
* for alt in curr_col: # <<<<<<<<<<<<<<
* next_id = curr[0]+alt[2]
* jump = 1
*/
- if (PyList_CheckExact(__pyx_v_curr_col) || PyTuple_CheckExact(__pyx_v_curr_col)) {
+ if (likely(PyList_CheckExact(__pyx_v_curr_col)) || PyTuple_CheckExact(__pyx_v_curr_col)) {
__pyx_t_5 = __pyx_v_curr_col; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
__pyx_t_9 = NULL;
} else {
__pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_curr_col); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext;
+ __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_5)) {
- if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_9 && PyTuple_CheckExact(__pyx_t_5)) {
- if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_9)) {
+ if (likely(PyList_CheckExact(__pyx_t_5))) {
+ if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_9(__pyx_t_5);
if (unlikely(!__pyx_t_1)) {
@@ -50203,7 +53294,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":973
+ /* "cdec/sa/rulefactory.pxi":973
* curr_col = _columns[curr[0]]
* for alt in curr_col:
* next_id = curr[0]+alt[2] # <<<<<<<<<<<<<<
@@ -50221,7 +53312,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_XDECREF_SET(__pyx_v_next_id, __pyx_t_10);
__pyx_t_10 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":974
+ /* "cdec/sa/rulefactory.pxi":974
* for alt in curr_col:
* next_id = curr[0]+alt[2]
* jump = 1 # <<<<<<<<<<<<<<
@@ -50231,7 +53322,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_INCREF(__pyx_int_1);
__Pyx_XDECREF_SET(__pyx_v_jump, __pyx_int_1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":975
+ /* "cdec/sa/rulefactory.pxi":975
* next_id = curr[0]+alt[2]
* jump = 1
* if alt[0] == EPSILON: # <<<<<<<<<<<<<<
@@ -50245,11 +53336,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_t_1 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_7) {
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":976
+ /* "cdec/sa/rulefactory.pxi":976
* jump = 1
* if alt[0] == EPSILON:
* jump = 0 # <<<<<<<<<<<<<<
@@ -50258,11 +53349,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
*/
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF_SET(__pyx_v_jump, __pyx_int_0);
- goto __pyx_L9;
+ goto __pyx_L11;
}
- __pyx_L9:;
+ __pyx_L11:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":977
+ /* "cdec/sa/rulefactory.pxi":977
* if alt[0] == EPSILON:
* jump = 0
* if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: # <<<<<<<<<<<<<<
@@ -50270,30 +53361,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
* return sorted(result);
*/
__pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, __pyx_v_result, Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_7) {
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
- __Pyx_DECREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyInt_From_long((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- }
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_6 = __pyx_t_4;
+ __pyx_t_6 = (__pyx_t_7 != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L14_next_and;
} else {
- __pyx_t_6 = __pyx_t_7;
+ __pyx_t_4 = __pyx_t_6;
+ goto __pyx_L13_bool_binop_done;
}
- if (__pyx_t_6) {
+ __pyx_L14_next_and:;
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_min_dist, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
+ __Pyx_DECREF(__pyx_t_1);
+ __pyx_t_10 = __Pyx_PyInt_From_long((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = __pyx_t_6;
+ __pyx_L13_bool_binop_done:;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978
+ /* "cdec/sa/rulefactory.pxi":978
* jump = 0
* if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1:
* candidate.append([next_id,curr[1]+jump]) # <<<<<<<<<<<<<<
@@ -50315,15 +53411,23 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_t_2 = 0;
__pyx_t_8 = __Pyx_PyList_Append(__pyx_v_candidate, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L10;
+ goto __pyx_L12;
}
- __pyx_L10:;
+ __pyx_L12:;
+
+ /* "cdec/sa/rulefactory.pxi":972
+ * result.append(curr[0]);
+ * curr_col = _columns[curr[0]]
+ * for alt in curr_col: # <<<<<<<<<<<<<<
+ * next_id = curr[0]+alt[2]
+ * jump = 1
+ */
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_L3_continue:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":979
+ /* "cdec/sa/rulefactory.pxi":979
* if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1:
* candidate.append([next_id,curr[1]+jump])
* return sorted(result); # <<<<<<<<<<<<<<
@@ -50343,7 +53447,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":961
+ /* "cdec/sa/rulefactory.pxi":961
* return min
*
* def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<<
@@ -50371,9 +53475,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_st
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":981
+/* "cdec/sa/rulefactory.pxi":981
* return sorted(result);
*
* def input(self, fwords, meta, ctx_name=None): # <<<<<<<<<<<<<<
@@ -50455,7 +53559,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObj
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1150
+/* "cdec/sa/rulefactory.pxi":1150
* if len(extracts) > 0:
* fcount = Counter()
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<<
@@ -50464,13 +53568,13 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObj
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda3, METH_NOARGS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda5 = {"lambda5", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda5, METH_NOARGS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
- __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self);
+ __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
@@ -50478,43 +53582,60 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda
}
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda3_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda3_lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda3_lambda4, METH_NOARGS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda3_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda5_lambda6(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda5_lambda6 = {"lambda6", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda5_lambda6, METH_NOARGS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda5_lambda6(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0);
- __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self);
+ __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda4", 0);
+ __Pyx_RefNannySetupContext("lambda6", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyList_Type))));
- __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)((PyObject*)(&PyList_Type)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type))));
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)((PyObject*)(&PyList_Type))));
+ __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type))));
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
@@ -50522,7 +53643,8 @@ static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda3.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda5.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -50530,32 +53652,51 @@ static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self) {
+static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda3", 0);
+ __Pyx_RefNannySetupContext("lambda5", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda3_lambda4, 0, __pyx_n_s_input_locals_lambda_locals_lambd, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda5_lambda6, 0, __pyx_n_s_input_locals_lambda_locals_lambd, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_1);
+ } else {
+ __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
@@ -50563,7 +53704,9 @@ static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -50571,7 +53714,7 @@ static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156
+/* "cdec/sa/rulefactory.pxi":1156
* for f, elist in fphrases.iteritems():
* for e, alslist in elist.iteritems():
* alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) # <<<<<<<<<<<<<<
@@ -50580,20 +53723,20 @@ static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda5(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda5, METH_O, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda5(PyObject *__pyx_self, PyObject *__pyx_v_x) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda7(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda7 = {"lambda7", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda7, METH_O, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda7(PyObject *__pyx_self, PyObject *__pyx_v_x) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0);
- __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self, ((PyObject *)__pyx_v_x));
+ __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0);
+ __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, ((PyObject *)__pyx_v_x));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
+static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -50601,7 +53744,7 @@ static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda5", 0);
+ __Pyx_RefNannySetupContext("lambda7", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
@@ -50616,16 +53759,16 @@ static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda7", __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_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196
+/* "cdec/sa/rulefactory.pxi":1196
* if self.online:
* stats = self.online_stats[ctx_name]
* f_syms = tuple(word[0][0] for word in fwords) # <<<<<<<<<<<<<<
@@ -50634,45 +53777,42 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4gener
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator15, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_input_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -50694,29 +53834,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4gener
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords)) { __Pyx_RaiseClosureNameError("fwords"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords)) {
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_fwords); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -50775,7 +53917,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4gener
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":981
+/* "cdec/sa/rulefactory.pxi":981
* return sorted(result);
*
* def input(self, fwords, meta, ctx_name=None): # <<<<<<<<<<<<<<
@@ -50784,14 +53926,14 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4gener
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_meta, PyObject *__pyx_v_ctx_name) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("input", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_input, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_input(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_input, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -50810,37 +53952,34 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(struc
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_ctx_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator5, (PyObject *) __pyx_cur_scope, __pyx_n_s_input, __pyx_n_s_HieroCachingRuleFactory_input); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- float __pyx_t_4;
- int __pyx_t_5;
- Py_ssize_t __pyx_t_6;
- int __pyx_t_7;
- PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ float __pyx_t_5;
+ int __pyx_t_6;
+ Py_ssize_t __pyx_t_7;
+ int __pyx_t_8;
int __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
@@ -50859,9 +53998,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
Py_ssize_t __pyx_t_24;
Py_ssize_t __pyx_t_25;
Py_ssize_t __pyx_t_26;
- int __pyx_t_27;
- int __pyx_t_28;
- PyObject *(*__pyx_t_29)(PyObject *);
+ PyObject *__pyx_t_27 = NULL;
+ PyObject *(*__pyx_t_28)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -50870,7 +54008,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
switch (__pyx_generator->resume_label) {
case 0: goto __pyx_L3_first_run;
case 1: goto __pyx_L61_resume_from_yield;
- case 2: goto __pyx_L82_resume_from_yield;
+ case 2: goto __pyx_L88_resume_from_yield;
default: /* CPython raises the right error here */
__Pyx_RefNannyFinishContext();
return NULL;
@@ -50878,7 +54016,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":992
+ /* "cdec/sa/rulefactory.pxi":992
* cdef Phrase hiero_phrase
*
* flen = len(fwords) # <<<<<<<<<<<<<<
@@ -50891,23 +54029,38 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_cur_scope->__pyx_v_flen = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":993
+ /* "cdec/sa/rulefactory.pxi":993
*
* flen = len(fwords)
* start_time = monitor_cpu() # <<<<<<<<<<<<<<
* self.extract_time = 0.0
* self.intersect_time = 0.0
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_cur_scope->__pyx_v_start_time = __pyx_t_4;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_cur_scope->__pyx_v_start_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":994
+ /* "cdec/sa/rulefactory.pxi":994
* flen = len(fwords)
* start_time = monitor_cpu()
* self.extract_time = 0.0 # <<<<<<<<<<<<<<
@@ -50916,7 +54069,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_self->extract_time = 0.0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":995
+ /* "cdec/sa/rulefactory.pxi":995
* start_time = monitor_cpu()
* self.extract_time = 0.0
* self.intersect_time = 0.0 # <<<<<<<<<<<<<<
@@ -50925,20 +54078,20 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_self->intersect_time = 0.0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":996
+ /* "cdec/sa/rulefactory.pxi":996
* self.extract_time = 0.0
* self.intersect_time = 0.0
* nodes_isteps_away_buffer = {} # <<<<<<<<<<<<<<
* hit = 0
* reachable_buffer = {}
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":997
+ /* "cdec/sa/rulefactory.pxi":997
* self.intersect_time = 0.0
* nodes_isteps_away_buffer = {}
* hit = 0 # <<<<<<<<<<<<<<
@@ -50947,149 +54100,149 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_hit = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":998
+ /* "cdec/sa/rulefactory.pxi":998
* nodes_isteps_away_buffer = {}
* hit = 0
* reachable_buffer = {} # <<<<<<<<<<<<<<
*
* # Phrase pairs processed by suffix array extractor. Do not re-extract
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_reachable_buffer = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_reachable_buffer = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1003
+ /* "cdec/sa/rulefactory.pxi":1003
* # during online extraction. This is probably the hackiest part of
* # online grammar extraction.
* seen_phrases = set() # <<<<<<<<<<<<<<
*
* # Do not cache between sentences
*/
- __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_cur_scope->__pyx_v_seen_phrases = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_v_seen_phrases = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1006
+ /* "cdec/sa/rulefactory.pxi":1006
*
* # Do not cache between sentences
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<<
*
* frontier = []
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_phrase_location, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_phrase_location, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->rules->root);
__Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->rules->root);
- __pyx_cur_scope->__pyx_v_self->rules->root = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_cur_scope->__pyx_v_self->rules->root = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1008
+ /* "cdec/sa/rulefactory.pxi":1008
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation())
*
* frontier = [] # <<<<<<<<<<<<<<
* for i in range(len(fwords)):
* for alt in range(0, len(fwords[i])):
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_cur_scope->__pyx_v_frontier = ((PyObject*)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_cur_scope->__pyx_v_frontier = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1009
+ /* "cdec/sa/rulefactory.pxi":1009
*
* frontier = []
* for i in range(len(fwords)): # <<<<<<<<<<<<<<
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON:
*/
- __pyx_t_1 = __pyx_cur_scope->__pyx_v_fwords;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
- __pyx_cur_scope->__pyx_v_i = __pyx_t_5;
+ __pyx_t_3 = __pyx_cur_scope->__pyx_v_fwords;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
+ __pyx_cur_scope->__pyx_v_i = __pyx_t_6;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1010
+ /* "cdec/sa/rulefactory.pxi":1010
* frontier = []
* for i in range(len(fwords)):
* for alt in range(0, len(fwords[i])): # <<<<<<<<<<<<<<
* if fwords[i][alt][0] != EPSILON:
* frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False))
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
- __pyx_cur_scope->__pyx_v_alt = __pyx_t_7;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+ __pyx_cur_scope->__pyx_v_alt = __pyx_t_8;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1011
+ /* "cdec/sa/rulefactory.pxi":1011
* for i in range(len(fwords)):
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON: # <<<<<<<<<<<<<<
* frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False))
*
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1012
+ /* "cdec/sa/rulefactory.pxi":1012
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON:
* frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False)) # <<<<<<<<<<<<<<
*
* xroot = None
*/
- __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
@@ -51102,10 +54255,10 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_INCREF(Py_False);
PyTuple_SET_ITEM(__pyx_t_11, 7, Py_False);
__Pyx_GIVEREF(Py_False);
- __pyx_t_8 = 0;
- __pyx_t_3 = 0;
- __pyx_t_10 = 0;
+ __pyx_t_4 = 0;
__pyx_t_1 = 0;
+ __pyx_t_10 = 0;
+ __pyx_t_3 = 0;
__pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, __pyx_t_11); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L8;
@@ -51114,7 +54267,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1014
+ /* "cdec/sa/rulefactory.pxi":1014
* frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False))
*
* xroot = None # <<<<<<<<<<<<<<
@@ -51125,7 +54278,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(Py_None);
__pyx_cur_scope->__pyx_v_xroot = Py_None;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1015
+ /* "cdec/sa/rulefactory.pxi":1015
*
* xroot = None
* x1 = sym_setindex(self.category, 1) # <<<<<<<<<<<<<<
@@ -51134,7 +54287,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_x1 = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1016
+ /* "cdec/sa/rulefactory.pxi":1016
* xroot = None
* x1 = sym_setindex(self.category, 1)
* if x1 in self.rules.root.children: # <<<<<<<<<<<<<<
@@ -51143,26 +54296,26 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_11, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_11, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1017
+ /* "cdec/sa/rulefactory.pxi":1017
* x1 = sym_setindex(self.category, 1)
* if x1 in self.rules.root.children:
* xroot = self.rules.root.children[x1] # <<<<<<<<<<<<<<
* else:
* xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation())
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_x1, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_x1, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot);
__Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_xroot, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
@@ -51171,7 +54324,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1019
+ /* "cdec/sa/rulefactory.pxi":1019
* xroot = self.rules.root.children[x1]
* else:
* xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) # <<<<<<<<<<<<<<
@@ -51181,85 +54334,85 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_suffix_link, __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_phrase_location, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_phrase_location, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_xroot, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_xroot, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1020
+ /* "cdec/sa/rulefactory.pxi":1020
* else:
* xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation())
* self.rules.root.children[x1] = xroot # <<<<<<<<<<<<<<
*
* for i in range(self.min_gap_size, len(fwords)):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s_children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L9:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1022
+ /* "cdec/sa/rulefactory.pxi":1022
* self.rules.root.children[x1] = xroot
*
* for i in range(self.min_gap_size, len(fwords)): # <<<<<<<<<<<<<<
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON:
*/
- __pyx_t_1 = __pyx_cur_scope->__pyx_v_fwords;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- for (__pyx_t_5 = __pyx_cur_scope->__pyx_v_self->min_gap_size; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
- __pyx_cur_scope->__pyx_v_i = __pyx_t_5;
+ __pyx_t_3 = __pyx_cur_scope->__pyx_v_fwords;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ for (__pyx_t_6 = __pyx_cur_scope->__pyx_v_self->min_gap_size; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
+ __pyx_cur_scope->__pyx_v_i = __pyx_t_6;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1023
+ /* "cdec/sa/rulefactory.pxi":1023
*
* for i in range(self.min_gap_size, len(fwords)):
* for alt in range(0, len(fwords[i])): # <<<<<<<<<<<<<<
* if fwords[i][alt][0] != EPSILON:
* frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True))
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
- __pyx_cur_scope->__pyx_v_alt = __pyx_t_7;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_7 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
+ __pyx_cur_scope->__pyx_v_alt = __pyx_t_8;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1024
+ /* "cdec/sa/rulefactory.pxi":1024
* for i in range(self.min_gap_size, len(fwords)):
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON: # <<<<<<<<<<<<<<
* frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True))
*
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1025
+ /* "cdec/sa/rulefactory.pxi":1025
* for alt in range(0, len(fwords[i])):
* if fwords[i][alt][0] != EPSILON:
* frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True)) # <<<<<<<<<<<<<<
@@ -51270,17 +54423,17 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__pyx_t_14 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
@@ -51294,12 +54447,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_xroot);
PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_cur_scope->__pyx_v_xroot);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xroot);
@@ -51310,9 +54463,9 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(Py_True);
__pyx_t_10 = 0;
__pyx_t_11 = 0;
- __pyx_t_3 = 0;
__pyx_t_1 = 0;
- __pyx_t_8 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_4 = 0;
__pyx_t_15 = 0;
__pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, __pyx_t_14); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
@@ -51322,7 +54475,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1027
+ /* "cdec/sa/rulefactory.pxi":1027
* frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True))
*
* next_states = [] # <<<<<<<<<<<<<<
@@ -51335,7 +54488,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_cur_scope->__pyx_v_next_states = ((PyObject*)__pyx_t_14);
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1028
+ /* "cdec/sa/rulefactory.pxi":1028
*
* next_states = []
* for i in range(len(fwords)): # <<<<<<<<<<<<<<
@@ -51346,42 +54499,57 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_INCREF(__pyx_t_14);
__pyx_t_2 = PyObject_Length(__pyx_t_14); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
- __pyx_cur_scope->__pyx_v_i = __pyx_t_5;
+ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
+ __pyx_cur_scope->__pyx_v_i = __pyx_t_6;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1029
+ /* "cdec/sa/rulefactory.pxi":1029
* next_states = []
* for i in range(len(fwords)):
* next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) # <<<<<<<<<<<<<<
*
* while len(frontier) > 0:
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_next_states); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_next_states); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ __pyx_t_11 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ if (__pyx_t_1) {
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_7, __pyx_cur_scope->__pyx_v_fwords);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_15);
- __Pyx_GIVEREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_15 = 0;
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_7, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_7, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_11, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_14); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_8); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1031
+ /* "cdec/sa/rulefactory.pxi":1031
* next_states.append(self.get_next_states(fwords,i,self.min_gap_size))
*
* while len(frontier) > 0: # <<<<<<<<<<<<<<
@@ -51393,37 +54561,37 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_13 = ((__pyx_t_2 > 0) != 0);
if (!__pyx_t_13) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1032
+ /* "cdec/sa/rulefactory.pxi":1032
*
* while len(frontier) > 0:
* new_frontier = [] # <<<<<<<<<<<<<<
* for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier:
* word_id = fwords[i][alt][0]
*/
- __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_new_frontier);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject*)__pyx_t_8));
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject*)__pyx_t_14));
+ __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1033
+ /* "cdec/sa/rulefactory.pxi":1033
* while len(frontier) > 0:
* new_frontier = []
* for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: # <<<<<<<<<<<<<<
* word_id = fwords[i][alt][0]
* spanlen = fwords[i][alt][2]
*/
- __pyx_t_8 = __pyx_cur_scope->__pyx_v_frontier; __Pyx_INCREF(__pyx_t_8); __pyx_t_2 = 0;
+ __pyx_t_14 = __pyx_cur_scope->__pyx_v_frontier; __Pyx_INCREF(__pyx_t_14); __pyx_t_2 = 0;
for (;;) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_8)) break;
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_14)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_2); __Pyx_INCREF(__pyx_t_15); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
- PyObject* sequence = __pyx_t_1;
+ if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
+ PyObject* sequence = __pyx_t_15;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -51436,28 +54604,28 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3);
+ __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 4);
__pyx_t_16 = PyTuple_GET_ITEM(sequence, 5);
__pyx_t_17 = PyTuple_GET_ITEM(sequence, 6);
__pyx_t_18 = PyTuple_GET_ITEM(sequence, 7);
} else {
- __pyx_t_14 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_15 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 3);
+ __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 3);
__pyx_t_10 = PyList_GET_ITEM(sequence, 4);
__pyx_t_16 = PyList_GET_ITEM(sequence, 5);
__pyx_t_17 = PyList_GET_ITEM(sequence, 6);
__pyx_t_18 = PyList_GET_ITEM(sequence, 7);
}
- __Pyx_INCREF(__pyx_t_14);
- __Pyx_INCREF(__pyx_t_15);
- __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_16);
__Pyx_INCREF(__pyx_t_17);
@@ -51465,7 +54633,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
#else
{
Py_ssize_t i;
- PyObject** temps[8] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_3,&__pyx_t_11,&__pyx_t_10,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18};
+ PyObject** temps[8] = {&__pyx_t_11,&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_10,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18};
for (i=0; i < 8; i++) {
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
@@ -51473,13 +54641,13 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
}
#endif
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[8] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_3,&__pyx_t_11,&__pyx_t_10,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18};
- __pyx_t_19 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject** temps[8] = {&__pyx_t_11,&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_10,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18};
+ __pyx_t_19 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_19);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_20 = Py_TYPE(__pyx_t_19)->tp_iternext;
for (index=0; index < 8; index++) {
PyObject* item = __pyx_t_20(__pyx_t_19); if (unlikely(!item)) goto __pyx_L21_unpacking_failed;
@@ -51497,18 +54665,18 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L22_unpacking_done:;
}
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_14); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_cur_scope->__pyx_v_k = __pyx_t_5;
- __pyx_cur_scope->__pyx_v_i = __pyx_t_7;
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_cur_scope->__pyx_v_k = __pyx_t_6;
+ __pyx_cur_scope->__pyx_v_i = __pyx_t_8;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_input_match);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_input_match, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_input_match, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
__pyx_cur_scope->__pyx_v_alt = __pyx_t_21;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pathlen);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pathlen, __pyx_t_10);
@@ -51527,62 +54695,62 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(__pyx_t_18);
__pyx_t_18 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1034
+ /* "cdec/sa/rulefactory.pxi":1034
* new_frontier = []
* for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier:
* word_id = fwords[i][alt][0] # <<<<<<<<<<<<<<
* spanlen = fwords[i][alt][2]
* # TODO get rid of k -- pathlen is replacing it
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_15, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_18, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_18, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word_id);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1035
+ /* "cdec/sa/rulefactory.pxi":1035
* for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier:
* word_id = fwords[i][alt][0]
* spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<<
* # TODO get rid of k -- pathlen is replacing it
* if word_id == EPSILON:
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_15, __pyx_cur_scope->__pyx_v_alt, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_18, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_18, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1037
+ /* "cdec/sa/rulefactory.pxi":1037
* spanlen = fwords[i][alt][2]
* # TODO get rid of k -- pathlen is replacing it
* if word_id == EPSILON: # <<<<<<<<<<<<<<
* # skipping because word_id is epsilon
* if i+spanlen >= len(fwords):
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_15, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1039
+ /* "cdec/sa/rulefactory.pxi":1039
* if word_id == EPSILON:
* # skipping because word_id is epsilon
* if i+spanlen >= len(fwords): # <<<<<<<<<<<<<<
@@ -51591,23 +54759,23 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __pyx_t_1 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_18 = __pyx_cur_scope->__pyx_v_fwords;
__Pyx_INCREF(__pyx_t_18);
- __pyx_t_6 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __pyx_t_17 = PyObject_RichCompare(__pyx_t_1, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_17 = PyObject_RichCompare(__pyx_t_15, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1040
+ /* "cdec/sa/rulefactory.pxi":1040
* # skipping because word_id is epsilon
* if i+spanlen >= len(fwords):
* continue # <<<<<<<<<<<<<<
@@ -51617,7 +54785,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
goto __pyx_L19_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1041
+ /* "cdec/sa/rulefactory.pxi":1041
* if i+spanlen >= len(fwords):
* continue
* for nualt in range(0,len(fwords[i+spanlen])): # <<<<<<<<<<<<<<
@@ -51632,12 +54800,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_17);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_6 = PyObject_Length(__pyx_t_17); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_Length(__pyx_t_17); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_6; __pyx_t_21+=1) {
+ for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_7; __pyx_t_21+=1) {
__pyx_cur_scope->__pyx_v_nualt = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1042
+ /* "cdec/sa/rulefactory.pxi":1042
* continue
* for nualt in range(0,len(fwords[i+spanlen])):
* frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) # <<<<<<<<<<<<<<
@@ -51648,8 +54816,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GOTREF(__pyx_t_17);
__pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __pyx_t_1 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_nualt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
@@ -51657,8 +54825,8 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GOTREF(__pyx_t_16);
PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match);
PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_cur_scope->__pyx_v_input_match);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match);
@@ -51677,13 +54845,13 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
PyTuple_SET_ITEM(__pyx_t_16, 7, __pyx_cur_scope->__pyx_v_is_shadow_path);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
__pyx_t_17 = 0;
- __pyx_t_1 = 0;
+ __pyx_t_15 = 0;
__pyx_t_18 = 0;
__pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, __pyx_t_16); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1043
+ /* "cdec/sa/rulefactory.pxi":1043
* for nualt in range(0,len(fwords[i+spanlen])):
* frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path))
* continue # <<<<<<<<<<<<<<
@@ -51693,7 +54861,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
goto __pyx_L19_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1045
+ /* "cdec/sa/rulefactory.pxi":1045
* continue
*
* phrase = prefix + (word_id,) # <<<<<<<<<<<<<<
@@ -51713,7 +54881,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(__pyx_t_18);
__pyx_t_18 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1046
+ /* "cdec/sa/rulefactory.pxi":1046
*
* phrase = prefix + (word_id,)
* hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<<
@@ -51733,23 +54901,38 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(__pyx_t_16);
__pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1047
+ /* "cdec/sa/rulefactory.pxi":1047
* phrase = prefix + (word_id,)
* hiero_phrase = Phrase(phrase)
* arity = hiero_phrase.arity() # <<<<<<<<<<<<<<
*
* lookup_required = False
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s_arity); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s_arity); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_18))) {
+ __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_18);
+ if (likely(__pyx_t_15)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
+ __Pyx_INCREF(__pyx_t_15);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_18, function);
+ }
+ }
+ if (__pyx_t_15) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ } else {
+ __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_cur_scope->__pyx_v_arity = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1049
+ /* "cdec/sa/rulefactory.pxi":1049
* arity = hiero_phrase.arity()
*
* lookup_required = False # <<<<<<<<<<<<<<
@@ -51758,38 +54941,38 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_lookup_required = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1050
+ /* "cdec/sa/rulefactory.pxi":1050
*
* lookup_required = False
* if word_id in node.children: # <<<<<<<<<<<<<<
* if node.children[word_id] is None:
* # Path dead-ends at this node
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_13 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_13 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_16, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_9 = (__pyx_t_13 != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1051
+ /* "cdec/sa/rulefactory.pxi":1051
* lookup_required = False
* if word_id in node.children:
* if node.children[word_id] is None: # <<<<<<<<<<<<<<
* # Path dead-ends at this node
* continue
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_16 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_9 = (__pyx_t_16 == Py_None);
+ __pyx_t_18 = PyObject_GetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_18);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_9 = (__pyx_t_18 == Py_None);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1053
+ /* "cdec/sa/rulefactory.pxi":1053
* if node.children[word_id] is None:
* # Path dead-ends at this node
* continue # <<<<<<<<<<<<<<
@@ -51800,42 +54983,42 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1056
+ /* "cdec/sa/rulefactory.pxi":1056
* else:
* # Path continues at this node
* node = node.children[word_id] # <<<<<<<<<<<<<<
* else:
* if node.suffix_link is None:
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_18 = PyObject_GetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
}
goto __pyx_L27;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1058
+ /* "cdec/sa/rulefactory.pxi":1058
* node = node.children[word_id]
* else:
* if node.suffix_link is None: # <<<<<<<<<<<<<<
* # Current node is root; lookup required
* lookup_required = True
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_13 = (__pyx_t_18 == Py_None);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_13 = (__pyx_t_16 == Py_None);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_9 = (__pyx_t_13 != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1060
+ /* "cdec/sa/rulefactory.pxi":1060
* if node.suffix_link is None:
* # Current node is root; lookup required
* lookup_required = True # <<<<<<<<<<<<<<
@@ -51847,56 +55030,56 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1062
+ /* "cdec/sa/rulefactory.pxi":1062
* lookup_required = True
* else:
* if word_id in node.suffix_link.children: # <<<<<<<<<<<<<<
* if node.suffix_link.children[word_id] is None:
* # Suffix link reports path is dead end
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_16, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1063
+ /* "cdec/sa/rulefactory.pxi":1063
* else:
* if word_id in node.suffix_link.children:
* if node.suffix_link.children[word_id] is None: # <<<<<<<<<<<<<<
* # Suffix link reports path is dead end
* node.children[word_id] = None
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_t_16 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_13 = (__pyx_t_16 == Py_None);
+ __pyx_t_18 = PyObject_GetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_18);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_13 = (__pyx_t_18 == Py_None);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_9 = (__pyx_t_13 != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1065
+ /* "cdec/sa/rulefactory.pxi":1065
* if node.suffix_link.children[word_id] is None:
* # Suffix link reports path is dead end
* node.children[word_id] = None # <<<<<<<<<<<<<<
* continue
* else:
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ if (unlikely(PyObject_SetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1066
+ /* "cdec/sa/rulefactory.pxi":1066
* # Suffix link reports path is dead end
* node.children[word_id] = None
* continue # <<<<<<<<<<<<<<
@@ -51907,7 +55090,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069
+ /* "cdec/sa/rulefactory.pxi":1069
* else:
* # Suffix link indicates lookup is reqired
* lookup_required = True # <<<<<<<<<<<<<<
@@ -51920,17 +55103,17 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1072
+ /* "cdec/sa/rulefactory.pxi":1072
* else:
* #ERROR: We never get here
* raise Exception("Keyword trie error") # <<<<<<<<<<<<<<
* # checking whether lookup_required
* if lookup_required:
*/
- __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_Raise(__pyx_t_16, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_18 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __Pyx_Raise(__pyx_t_18, 0, 0, 0);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L30:;
@@ -51939,7 +55122,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
__pyx_L27:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1074
+ /* "cdec/sa/rulefactory.pxi":1074
* raise Exception("Keyword trie error")
* # checking whether lookup_required
* if lookup_required: # <<<<<<<<<<<<<<
@@ -51949,7 +55132,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = (__pyx_cur_scope->__pyx_v_lookup_required != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1075
+ /* "cdec/sa/rulefactory.pxi":1075
* # checking whether lookup_required
* if lookup_required:
* new_node = None # <<<<<<<<<<<<<<
@@ -51961,7 +55144,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_node, Py_None);
__Pyx_GIVEREF(Py_None);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1076
+ /* "cdec/sa/rulefactory.pxi":1076
* if lookup_required:
* new_node = None
* if is_shadow_path: # <<<<<<<<<<<<<<
@@ -51971,75 +55154,75 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1079
+ /* "cdec/sa/rulefactory.pxi":1079
* # Extending shadow path
* # on the shadow path we don't do any search, we just use info from suffix link
* new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location, # <<<<<<<<<<<<<<
* suffix_link=node.suffix_link.children[word_id],
* phrase=hiero_phrase)
*/
- __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_phrase_location, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_phrase_location, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1080
+ /* "cdec/sa/rulefactory.pxi":1080
* # on the shadow path we don't do any search, we just use info from suffix link
* new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location,
* suffix_link=node.suffix_link.children[word_id], # <<<<<<<<<<<<<<
* phrase=hiero_phrase)
* else:
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_suffix_link, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_GetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_suffix_link, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1081
+ /* "cdec/sa/rulefactory.pxi":1081
* new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location,
* suffix_link=node.suffix_link.children[word_id],
* phrase=hiero_phrase) # <<<<<<<<<<<<<<
* else:
* if arity > 0:
*/
- if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_phrase, ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_phrase, ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1079
+ /* "cdec/sa/rulefactory.pxi":1079
* # Extending shadow path
* # on the shadow path we don't do any search, we just use info from suffix link
* new_node = ExtendedTrieNode(phrase_location=node.suffix_link.children[word_id].phrase_location, # <<<<<<<<<<<<<<
* suffix_link=node.suffix_link.children[word_id],
* phrase=hiero_phrase)
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
goto __pyx_L33;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1083
+ /* "cdec/sa/rulefactory.pxi":1083
* phrase=hiero_phrase)
* else:
* if arity > 0: # <<<<<<<<<<<<<<
@@ -52049,146 +55232,191 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = ((__pyx_cur_scope->__pyx_v_arity > 0) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1085
+ /* "cdec/sa/rulefactory.pxi":1085
* if arity > 0:
* # Intersecting because of arity > 0
* intersect_start_time = monitor_cpu() # <<<<<<<<<<<<<<
* phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase)
* intersect_stop_time = monitor_cpu()
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_16 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_18))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_18);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_18, function);
+ }
+ }
+ if (__pyx_t_16) {
+ __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ } else {
+ __pyx_t_15 = __Pyx_PyObject_CallNoArg(__pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_start_time);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_start_time, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- __pyx_t_16 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_start_time, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1086
+ /* "cdec/sa/rulefactory.pxi":1086
* # Intersecting because of arity > 0
* intersect_start_time = monitor_cpu()
* phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase) # <<<<<<<<<<<<<<
* intersect_stop_time = monitor_cpu()
* self.intersect_time += intersect_stop_time - intersect_start_time
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_t_16 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->intersect(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_node, __pyx_t_16, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_18 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->intersect(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_node, __pyx_t_15, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1));
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18));
+ __Pyx_GIVEREF(__pyx_t_18);
+ __pyx_t_18 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1087
+ /* "cdec/sa/rulefactory.pxi":1087
* intersect_start_time = monitor_cpu()
* phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase)
* intersect_stop_time = monitor_cpu() # <<<<<<<<<<<<<<
* self.intersect_time += intersect_stop_time - intersect_start_time
* else:
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_16) {
+ __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ } else {
+ __pyx_t_18 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_18);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_stop_time);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- __pyx_t_16 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_t_18);
+ __Pyx_GIVEREF(__pyx_t_18);
+ __pyx_t_18 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1088
+ /* "cdec/sa/rulefactory.pxi":1088
* phrase_location = self.intersect(node, node.suffix_link.children[word_id], hiero_phrase)
* intersect_stop_time = monitor_cpu()
* self.intersect_time += intersect_stop_time - intersect_start_time # <<<<<<<<<<<<<<
* else:
* # Suffix array search
*/
- __pyx_t_16 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_18); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = PyNumber_InPlaceAdd(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_cur_scope->__pyx_v_self->intersect_time = __pyx_t_4;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_16); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_cur_scope->__pyx_v_self->intersect_time = __pyx_t_5;
goto __pyx_L34;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1091
+ /* "cdec/sa/rulefactory.pxi":1091
* else:
* # Suffix array search
* phrase_location = node.phrase_location # <<<<<<<<<<<<<<
* sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high)
* if sa_range is not None:
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- if (!(likely(((__pyx_t_18) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_18, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18));
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_16));
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1092
+ /* "cdec/sa/rulefactory.pxi":1092
* # Suffix array search
* phrase_location = node.phrase_location
* sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high) # <<<<<<<<<<<<<<
* if sa_range is not None:
* phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1])
*/
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->fsa), __pyx_n_s_lookup); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->fsa), __pyx_n_s_lookup); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_18);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_16 = PyInt_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_18 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_7 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_17 = PyInt_FromSsize_t((__pyx_t_7 - 1)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_17);
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_17);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_t_18);
+ __Pyx_GIVEREF(__pyx_t_18);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_7, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_1 = 0;
- __pyx_t_16 = 0;
+ PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_7, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_18 = 0;
__pyx_t_17 = 0;
__pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sa_range);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sa_range, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sa_range, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1093
+ /* "cdec/sa/rulefactory.pxi":1093
* phrase_location = node.phrase_location
* sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high)
* if sa_range is not None: # <<<<<<<<<<<<<<
@@ -52199,35 +55427,35 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1094
+ /* "cdec/sa/rulefactory.pxi":1094
* sa_range = self.fsa.lookup(sym_tostring(phrase[-1]), len(phrase)-1, phrase_location.sa_low, phrase_location.sa_high)
* if sa_range is not None:
* phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) # <<<<<<<<<<<<<<
* else:
* phrase_location = None
*/
- __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_sa_low, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_sa_high, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_sa_low, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_sa_high, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location));
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_11));
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_phrase_location, ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_15));
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
goto __pyx_L35;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1096
+ /* "cdec/sa/rulefactory.pxi":1096
* phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1])
* else:
* phrase_location = None # <<<<<<<<<<<<<<
@@ -52243,7 +55471,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
__pyx_L34:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1098
+ /* "cdec/sa/rulefactory.pxi":1098
* phrase_location = None
*
* if phrase_location is None: # <<<<<<<<<<<<<<
@@ -52254,19 +55482,19 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = (__pyx_t_13 != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1099
+ /* "cdec/sa/rulefactory.pxi":1099
*
* if phrase_location is None:
* node.children[word_id] = None # <<<<<<<<<<<<<<
* # Search failed
* continue
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- if (unlikely(PyObject_SetItem(__pyx_t_11, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(PyObject_SetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1101
+ /* "cdec/sa/rulefactory.pxi":1101
* node.children[word_id] = None
* # Search failed
* continue # <<<<<<<<<<<<<<
@@ -52276,116 +55504,116 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
goto __pyx_L19_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1103
+ /* "cdec/sa/rulefactory.pxi":1103
* continue
* # Search succeeded
* suffix_link = self.rules.root # <<<<<<<<<<<<<<
* if node.suffix_link is not None:
* suffix_link = node.suffix_link.children[word_id]
*/
- __pyx_t_11 = __pyx_cur_scope->__pyx_v_self->rules->root;
- __Pyx_INCREF(__pyx_t_11);
+ __pyx_t_15 = __pyx_cur_scope->__pyx_v_self->rules->root;
+ __Pyx_INCREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1104
+ /* "cdec/sa/rulefactory.pxi":1104
* # Search succeeded
* suffix_link = self.rules.root
* if node.suffix_link is not None: # <<<<<<<<<<<<<<
* suffix_link = node.suffix_link.children[word_id]
* new_node = ExtendedTrieNode(phrase_location=phrase_location,
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_9 = (__pyx_t_11 != Py_None);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_9 = (__pyx_t_15 != Py_None);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1105
+ /* "cdec/sa/rulefactory.pxi":1105
* suffix_link = self.rules.root
* if node.suffix_link is not None:
* suffix_link = node.suffix_link.children[word_id] # <<<<<<<<<<<<<<
* new_node = ExtendedTrieNode(phrase_location=phrase_location,
* suffix_link=suffix_link,
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_GetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
goto __pyx_L37;
}
__pyx_L37:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1106
+ /* "cdec/sa/rulefactory.pxi":1106
* if node.suffix_link is not None:
* suffix_link = node.suffix_link.children[word_id]
* new_node = ExtendedTrieNode(phrase_location=phrase_location, # <<<<<<<<<<<<<<
* suffix_link=suffix_link,
* phrase=hiero_phrase)
*/
- __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_phrase_location, ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_phrase_location, ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1107
+ /* "cdec/sa/rulefactory.pxi":1107
* suffix_link = node.suffix_link.children[word_id]
* new_node = ExtendedTrieNode(phrase_location=phrase_location,
* suffix_link=suffix_link, # <<<<<<<<<<<<<<
* phrase=hiero_phrase)
* node.children[word_id] = new_node
*/
- if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_suffix_link, __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_suffix_link, __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1108
+ /* "cdec/sa/rulefactory.pxi":1108
* new_node = ExtendedTrieNode(phrase_location=phrase_location,
* suffix_link=suffix_link,
* phrase=hiero_phrase) # <<<<<<<<<<<<<<
* node.children[word_id] = new_node
* node = new_node
*/
- if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_phrase, ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_phrase, ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1106
+ /* "cdec/sa/rulefactory.pxi":1106
* if node.suffix_link is not None:
* suffix_link = node.suffix_link.children[word_id]
* new_node = ExtendedTrieNode(phrase_location=phrase_location, # <<<<<<<<<<<<<<
* suffix_link=suffix_link,
* phrase=hiero_phrase)
*/
- __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new_node, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
}
__pyx_L33:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1109
+ /* "cdec/sa/rulefactory.pxi":1109
* suffix_link=suffix_link,
* phrase=hiero_phrase)
* node.children[word_id] = new_node # <<<<<<<<<<<<<<
* node = new_node
*
*/
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (unlikely(PyObject_SetItem(__pyx_t_16, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1110
+ /* "cdec/sa/rulefactory.pxi":1110
* phrase=hiero_phrase)
* node.children[word_id] = new_node
* node = new_node # <<<<<<<<<<<<<<
@@ -52397,7 +55625,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_node, __pyx_cur_scope->__pyx_v_new_node);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1115
+ /* "cdec/sa/rulefactory.pxi":1115
* This should happen before we get to extraction (so that
* the node will exist if needed)'''
* if arity < self.max_nonterminals: # <<<<<<<<<<<<<<
@@ -52407,21 +55635,21 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_13 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1116
+ /* "cdec/sa/rulefactory.pxi":1116
* the node will exist if needed)'''
* if arity < self.max_nonterminals:
* xcat_index = arity+1 # <<<<<<<<<<<<<<
* xcat = sym_setindex(self.category, xcat_index)
* suffix_link_xcat_index = xcat_index
*/
- __pyx_t_10 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_16 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1117
+ /* "cdec/sa/rulefactory.pxi":1117
* if arity < self.max_nonterminals:
* xcat_index = arity+1
* xcat = sym_setindex(self.category, xcat_index) # <<<<<<<<<<<<<<
@@ -52431,7 +55659,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_21 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_xcat = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_21);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1118
+ /* "cdec/sa/rulefactory.pxi":1118
* xcat_index = arity+1
* xcat = sym_setindex(self.category, xcat_index)
* suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<<
@@ -52443,7 +55671,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index, __pyx_cur_scope->__pyx_v_xcat_index);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119
+ /* "cdec/sa/rulefactory.pxi":1119
* xcat = sym_setindex(self.category, xcat_index)
* suffix_link_xcat_index = xcat_index
* if is_shadow_path: # <<<<<<<<<<<<<<
@@ -52453,24 +55681,24 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1120
+ /* "cdec/sa/rulefactory.pxi":1120
* suffix_link_xcat_index = xcat_index
* if is_shadow_path:
* suffix_link_xcat_index = xcat_index-1 # <<<<<<<<<<<<<<
* suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index)
* node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location,
*/
- __pyx_t_10 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_16 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
goto __pyx_L39;
}
__pyx_L39:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1121
+ /* "cdec/sa/rulefactory.pxi":1121
* if is_shadow_path:
* suffix_link_xcat_index = xcat_index-1
* suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index) # <<<<<<<<<<<<<<
@@ -52480,86 +55708,86 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_21 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_cur_scope->__pyx_v_suffix_link_xcat = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_21);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1122
+ /* "cdec/sa/rulefactory.pxi":1122
* suffix_link_xcat_index = xcat_index-1
* suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index)
* node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<<
* suffix_link=node.suffix_link.children[suffix_link_xcat],
* phrase= Phrase(phrase + (xcat,)))
*/
- __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_phrase_location, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_16 = PyDict_New(); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_phrase_location, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1123
+ /* "cdec/sa/rulefactory.pxi":1123
* suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index)
* node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location,
* suffix_link=node.suffix_link.children[suffix_link_xcat], # <<<<<<<<<<<<<<
* phrase= Phrase(phrase + (xcat,)))
*
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_suffix_link_xcat, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_suffix_link, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_suffix_link); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_suffix_link_xcat, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_suffix_link, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1124
+ /* "cdec/sa/rulefactory.pxi":1124
* node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location,
* suffix_link=node.suffix_link.children[suffix_link_xcat],
* phrase= Phrase(phrase + (xcat,))) # <<<<<<<<<<<<<<
*
* # sample from range
*/
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, __pyx_t_18); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_18, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_phrase, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_phrase, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1122
+ /* "cdec/sa/rulefactory.pxi":1122
* suffix_link_xcat_index = xcat_index-1
* suffix_link_xcat = sym_setindex(self.category, suffix_link_xcat_index)
* node.children[xcat] = ExtendedTrieNode(phrase_location=node.phrase_location, # <<<<<<<<<<<<<<
* suffix_link=node.suffix_link.children[suffix_link_xcat],
* phrase= Phrase(phrase + (xcat,)))
*/
- __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_10, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_11, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_16, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_15, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
goto __pyx_L38;
}
__pyx_L38:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1127
+ /* "cdec/sa/rulefactory.pxi":1127
*
* # sample from range
* if not is_shadow_path: # <<<<<<<<<<<<<<
@@ -52570,67 +55798,84 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = ((!__pyx_t_13) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1128
+ /* "cdec/sa/rulefactory.pxi":1128
* # sample from range
* if not is_shadow_path:
* sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<<
* num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns
* chunklen = IntList(initial_len=num_subpatterns)
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s_sample); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_18, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s_sample); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
+ }
+ }
+ if (!__pyx_t_1) {
+ __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GOTREF(__pyx_t_15);
+ } else {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_10, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sample, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_10));
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sample, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_15));
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1129
+ /* "cdec/sa/rulefactory.pxi":1129
* if not is_shadow_path:
* sample = self.sampler.sample(node.phrase_location)
* num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns # <<<<<<<<<<<<<<
* chunklen = IntList(initial_len=num_subpatterns)
* for j from 0 <= j < num_subpatterns:
*/
- __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_21 = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10)->num_subpatterns;
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_phrase_location); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_21 = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_15)->num_subpatterns;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1130
+ /* "cdec/sa/rulefactory.pxi":1130
* sample = self.sampler.sample(node.phrase_location)
* num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns
* chunklen = IntList(initial_len=num_subpatterns) # <<<<<<<<<<<<<<
* for j from 0 <= j < num_subpatterns:
* chunklen.arr[j] = hiero_phrase.chunklen(j)
*/
- __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_initial_len, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_initial_len, __pyx_t_16) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, __pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_chunklen, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18));
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_chunklen, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_16));
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1131
+ /* "cdec/sa/rulefactory.pxi":1131
* num_subpatterns = (<PhraseLocation> node.phrase_location).num_subpatterns
* chunklen = IntList(initial_len=num_subpatterns)
* for j from 0 <= j < num_subpatterns: # <<<<<<<<<<<<<<
@@ -52640,7 +55885,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_21 = __pyx_cur_scope->__pyx_v_num_subpatterns;
for (__pyx_cur_scope->__pyx_v_j = 0; __pyx_cur_scope->__pyx_v_j < __pyx_t_21; __pyx_cur_scope->__pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1132
+ /* "cdec/sa/rulefactory.pxi":1132
* chunklen = IntList(initial_len=num_subpatterns)
* for j from 0 <= j < num_subpatterns:
* chunklen.arr[j] = hiero_phrase.chunklen(j) # <<<<<<<<<<<<<<
@@ -52650,21 +55895,21 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
(__pyx_cur_scope->__pyx_v_chunklen->arr[__pyx_cur_scope->__pyx_v_j]) = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_cur_scope->__pyx_v_hiero_phrase->__pyx_vtab)->chunklen(__pyx_cur_scope->__pyx_v_hiero_phrase, __pyx_cur_scope->__pyx_v_j);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1133
+ /* "cdec/sa/rulefactory.pxi":1133
* for j from 0 <= j < num_subpatterns:
* chunklen.arr[j] = hiero_phrase.chunklen(j)
* extracts = [] # <<<<<<<<<<<<<<
* j = 0
* extract_start = monitor_cpu()
*/
- __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extracts);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extracts, ((PyObject*)__pyx_t_18));
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extracts, ((PyObject*)__pyx_t_16));
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1134
+ /* "cdec/sa/rulefactory.pxi":1134
* chunklen.arr[j] = hiero_phrase.chunklen(j)
* extracts = []
* j = 0 # <<<<<<<<<<<<<<
@@ -52673,24 +55918,39 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_j = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1135
+ /* "cdec/sa/rulefactory.pxi":1135
* extracts = []
* j = 0
* extract_start = monitor_cpu() # <<<<<<<<<<<<<<
* while j < sample.len:
* extract = []
*/
- __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_start, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_start, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1136
+ /* "cdec/sa/rulefactory.pxi":1136
* j = 0
* extract_start = monitor_cpu()
* while j < sample.len: # <<<<<<<<<<<<<<
@@ -52701,21 +55961,21 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = ((__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len) != 0);
if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1137
+ /* "cdec/sa/rulefactory.pxi":1137
* extract_start = monitor_cpu()
* while j < sample.len:
* extract = [] # <<<<<<<<<<<<<<
*
* assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr)
*/
- __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1139
+ /* "cdec/sa/rulefactory.pxi":1139
* extract = []
*
* assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) # <<<<<<<<<<<<<<
@@ -52724,77 +55984,79 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_f_4cdec_2sa_3_sa_assign_matching((&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_sample->arr, __pyx_cur_scope->__pyx_v_j, __pyx_cur_scope->__pyx_v_num_subpatterns, __pyx_cur_scope->__pyx_v_self->fda->sent_id->arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1140
+ /* "cdec/sa/rulefactory.pxi":1140
*
* assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr)
* loc = tuple(sample[j:j+num_subpatterns]) # <<<<<<<<<<<<<<
* extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns)
* extracts.extend([(e, loc) for e in extract])
*/
- __pyx_t_10 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_cur_scope->__pyx_v_sample), __pyx_cur_scope->__pyx_v_j, (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns), NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
- __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_18, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_16 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_cur_scope->__pyx_v_sample), __pyx_cur_scope->__pyx_v_j, (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns), NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_15, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1141
+ /* "cdec/sa/rulefactory.pxi":1141
* assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr)
* loc = tuple(sample[j:j+num_subpatterns])
* extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) # <<<<<<<<<<<<<<
* extracts.extend([(e, loc) for e in extract])
* j = j + num_subpatterns
*/
- __pyx_t_10 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->extract(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_hiero_phrase, (&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_chunklen->arr, __pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_16 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->extract(__pyx_cur_scope->__pyx_v_self, __pyx_cur_scope->__pyx_v_hiero_phrase, (&__pyx_cur_scope->__pyx_v_matching), __pyx_cur_scope->__pyx_v_chunklen->arr, __pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_extract, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_extract, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1142
+ /* "cdec/sa/rulefactory.pxi":1142
* loc = tuple(sample[j:j+num_subpatterns])
* extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns)
* extracts.extend([(e, loc) for e in extract]) # <<<<<<<<<<<<<<
* j = j + num_subpatterns
*
*/
- __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) {
- __pyx_t_18 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_18); __pyx_t_6 = 0;
+ __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) {
+ __pyx_t_15 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_15); __pyx_t_7 = 0;
__pyx_t_22 = NULL;
} else {
- __pyx_t_6 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_22 = Py_TYPE(__pyx_t_18)->tp_iternext;
+ __pyx_t_7 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_22 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_18)) {
- if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_18)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_11 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_6); __Pyx_INCREF(__pyx_t_11); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_11 = PySequence_ITEM(__pyx_t_18, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_18)) {
- if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_18)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_6); __Pyx_INCREF(__pyx_t_11); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_11 = PySequence_ITEM(__pyx_t_18, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_22)) {
+ if (likely(PyList_CheckExact(__pyx_t_15))) {
+ if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_15)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_10 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_10 = PySequence_ITEM(__pyx_t_15, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_10 = PySequence_ITEM(__pyx_t_15, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_11 = __pyx_t_22(__pyx_t_18);
- if (unlikely(!__pyx_t_11)) {
+ __pyx_t_10 = __pyx_t_22(__pyx_t_15);
+ if (unlikely(!__pyx_t_10)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -52802,28 +56064,28 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
break;
}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_GOTREF(__pyx_t_10);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
+ __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_loc);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_cur_scope->__pyx_v_loc);
+ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_cur_scope->__pyx_v_loc);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_loc);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_11))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_16, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_12 = __Pyx_PyList_Extend(__pyx_cur_scope->__pyx_v_extracts, __pyx_t_10); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = __Pyx_PyList_Extend(__pyx_cur_scope->__pyx_v_extracts, __pyx_t_16); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1143
+ /* "cdec/sa/rulefactory.pxi":1143
* extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns)
* extracts.extend([(e, loc) for e in extract])
* j = j + num_subpatterns # <<<<<<<<<<<<<<
@@ -52833,7 +56095,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1145
+ /* "cdec/sa/rulefactory.pxi":1145
* j = j + num_subpatterns
*
* num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<<
@@ -52862,112 +56124,159 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
__pyx_cur_scope->__pyx_v_num_samples = __Pyx_div_int(__pyx_cur_scope->__pyx_v_sample->len, __pyx_cur_scope->__pyx_v_num_subpatterns);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1146
+ /* "cdec/sa/rulefactory.pxi":1146
*
* num_samples = sample.len/num_subpatterns
* extract_stop = monitor_cpu() # <<<<<<<<<<<<<<
* self.extract_time = self.extract_time + extract_stop - extract_start
* if len(extracts) > 0:
*/
- __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_stop, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_extract_stop, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147
+ /* "cdec/sa/rulefactory.pxi":1147
* num_samples = sample.len/num_subpatterns
* extract_stop = monitor_cpu()
* self.extract_time = self.extract_time + extract_stop - extract_start # <<<<<<<<<<<<<<
* if len(extracts) > 0:
* fcount = Counter()
*/
- __pyx_t_18 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = PyNumber_Subtract(__pyx_t_10, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_18); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_4;
+ __pyx_t_16 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = PyNumber_Add(__pyx_t_16, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyNumber_Subtract(__pyx_t_15, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_16); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1148
+ /* "cdec/sa/rulefactory.pxi":1148
* extract_stop = monitor_cpu()
* self.extract_time = self.extract_time + extract_stop - extract_start
* if len(extracts) > 0: # <<<<<<<<<<<<<<
* fcount = Counter()
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
*/
- __pyx_t_6 = PyList_GET_SIZE(__pyx_cur_scope->__pyx_v_extracts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = ((__pyx_t_6 > 0) != 0);
+ __pyx_t_7 = PyList_GET_SIZE(__pyx_cur_scope->__pyx_v_extracts); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = ((__pyx_t_7 > 0) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1149
+ /* "cdec/sa/rulefactory.pxi":1149
* self.extract_time = self.extract_time + extract_stop - extract_start
* if len(extracts) > 0:
* fcount = Counter() # <<<<<<<<<<<<<<
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
* for (f, e, count, als), loc in extracts:
*/
- __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_Counter); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_Counter); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_10 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_10)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_10) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ } else {
+ __pyx_t_16 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fcount);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1150
+ /* "cdec/sa/rulefactory.pxi":1150
* if len(extracts) > 0:
* fcount = Counter()
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<<
* for (f, e, count, als), loc in extracts:
* fcount[f] += count
*/
- __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_defaultdict); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda5, 0, __pyx_n_s_input_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda3, 0, __pyx_n_s_input_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
- __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_16);
+ } else {
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_1, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fphrases);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fphrases, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_fphrases, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1151
+ /* "cdec/sa/rulefactory.pxi":1151
* fcount = Counter()
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
* for (f, e, count, als), loc in extracts: # <<<<<<<<<<<<<<
* fcount[f] += count
* fphrases[f][e][als].append(loc)
*/
- __pyx_t_18 = __pyx_cur_scope->__pyx_v_extracts; __Pyx_INCREF(__pyx_t_18); __pyx_t_6 = 0;
+ __pyx_t_16 = __pyx_cur_scope->__pyx_v_extracts; __Pyx_INCREF(__pyx_t_16); __pyx_t_7 = 0;
for (;;) {
- if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_18)) break;
+ if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_16)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_11 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_6); __Pyx_INCREF(__pyx_t_11); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_7); __Pyx_INCREF(__pyx_t_15); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_11 = PySequence_ITEM(__pyx_t_18, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PySequence_ITEM(__pyx_t_16, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
- PyObject* sequence = __pyx_t_11;
+ if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
+ PyObject* sequence = __pyx_t_15;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -52980,44 +56289,44 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
+ __Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_10);
- __Pyx_INCREF(__pyx_t_17);
#else
- __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
- __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
#endif
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_16 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_20 = Py_TYPE(__pyx_t_16)->tp_iternext;
- index = 0; __pyx_t_10 = __pyx_t_20(__pyx_t_16); if (unlikely(!__pyx_t_10)) goto __pyx_L50_unpacking_failed;
+ __pyx_t_3 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ index = 0; __pyx_t_1 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L50_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_1);
+ index = 1; __pyx_t_10 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_10)) goto __pyx_L50_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
- index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_16); if (unlikely(!__pyx_t_17)) goto __pyx_L50_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_17);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_16), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_20 = NULL;
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L51_unpacking_done;
__pyx_L50_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_20 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L51_unpacking_done:;
}
- if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
- PyObject* sequence = __pyx_t_10;
+ if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
+ PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -53030,24 +56339,24 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 3);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3);
} else {
- __pyx_t_16 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_15 = PyList_GET_ITEM(sequence, 3);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_17 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_18 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 3);
}
- __Pyx_INCREF(__pyx_t_16);
- __Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_17);
+ __Pyx_INCREF(__pyx_t_18);
+ __Pyx_INCREF(__pyx_t_4);
#else
{
Py_ssize_t i;
- PyObject** temps[4] = {&__pyx_t_16,&__pyx_t_1,&__pyx_t_3,&__pyx_t_15};
+ PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_17,&__pyx_t_18,&__pyx_t_4};
for (i=0; i < 4; i++) {
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
@@ -53055,52 +56364,52 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
}
#endif
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[4] = {&__pyx_t_16,&__pyx_t_1,&__pyx_t_3,&__pyx_t_15};
- __pyx_t_14 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_20 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_17,&__pyx_t_18,&__pyx_t_4};
+ __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_20 = Py_TYPE(__pyx_t_11)->tp_iternext;
for (index=0; index < 4; index++) {
- PyObject* item = __pyx_t_20(__pyx_t_14); if (unlikely(!item)) goto __pyx_L52_unpacking_failed;
+ PyObject* item = __pyx_t_20(__pyx_t_11); if (unlikely(!item)) goto __pyx_L52_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_14), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_11), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_20 = NULL;
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L53_unpacking_done;
__pyx_L52_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_20 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L53_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- __pyx_t_16 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_als, __pyx_t_15);
- __Pyx_GIVEREF(__pyx_t_15);
- __pyx_t_15 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_17);
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
__pyx_t_17 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_18);
+ __Pyx_GIVEREF(__pyx_t_18);
+ __pyx_t_18 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_als, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_loc, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1152
+ /* "cdec/sa/rulefactory.pxi":1152
* fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
* for (f, e, count, als), loc in extracts:
* fcount[f] += count # <<<<<<<<<<<<<<
@@ -53108,69 +56417,77 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
* for f, elist in fphrases.iteritems():
*/
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- __pyx_t_11 = __pyx_cur_scope->__pyx_v_f;
- __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_11); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_17);
- __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __pyx_cur_scope->__pyx_v_f;
+ __pyx_t_10 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_15); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_11, __pyx_t_10) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_10, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_15, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153
+ /* "cdec/sa/rulefactory.pxi":1153
* for (f, e, count, als), loc in extracts:
* fcount[f] += count
* fphrases[f][e][als].append(loc) # <<<<<<<<<<<<<<
* for f, elist in fphrases.iteritems():
* for e, alslist in elist.iteritems():
*/
- __pyx_t_11 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_10 = PyObject_GetItem(__pyx_t_11, __pyx_cur_scope->__pyx_v_e); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_als); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_11, __pyx_cur_scope->__pyx_v_loc); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_e); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_als); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_15, __pyx_cur_scope->__pyx_v_loc); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1151
+ * fcount = Counter()
+ * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))
+ * for (f, e, count, als), loc in extracts: # <<<<<<<<<<<<<<
+ * fcount[f] += count
+ * fphrases[f][e][als].append(loc)
+ */
}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1154
+ /* "cdec/sa/rulefactory.pxi":1154
* fcount[f] += count
* fphrases[f][e][als].append(loc)
* for f, elist in fphrases.iteritems(): # <<<<<<<<<<<<<<
* for e, alslist in elist.iteritems():
* alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1]))
*/
- __pyx_t_6 = 0;
+ __pyx_t_7 = 0;
if (unlikely(__pyx_cur_scope->__pyx_v_fphrases == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_11 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, __pyx_n_s_iteritems, (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_XDECREF(__pyx_t_18);
- __pyx_t_18 = __pyx_t_11;
- __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, __pyx_n_s_iteritems, (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
+ __pyx_t_16 = __pyx_t_15;
+ __pyx_t_15 = 0;
while (1) {
- __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_18, __pyx_t_23, &__pyx_t_6, &__pyx_t_11, &__pyx_t_10, NULL, __pyx_t_21);
- if (unlikely(__pyx_t_7 == 0)) break;
- if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_16, __pyx_t_23, &__pyx_t_7, &__pyx_t_15, &__pyx_t_1, NULL, __pyx_t_21);
+ if (unlikely(__pyx_t_8 == 0)) break;
+ if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elist, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elist, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1155
+ /* "cdec/sa/rulefactory.pxi":1155
* fphrases[f][e][als].append(loc)
* for f, elist in fphrases.iteritems():
* for e, alslist in elist.iteritems(): # <<<<<<<<<<<<<<
@@ -53182,55 +56499,70 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_11 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, __pyx_n_s_iteritems, (&__pyx_t_25), (&__pyx_t_7)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_XDECREF(__pyx_t_10);
- __pyx_t_10 = __pyx_t_11;
- __pyx_t_11 = 0;
+ __pyx_t_15 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, __pyx_n_s_iteritems, (&__pyx_t_25), (&__pyx_t_8)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_1);
+ __pyx_t_1 = __pyx_t_15;
+ __pyx_t_15 = 0;
while (1) {
- __pyx_t_5 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_25, &__pyx_t_24, &__pyx_t_11, &__pyx_t_17, NULL, __pyx_t_7);
- if (unlikely(__pyx_t_5 == 0)) break;
- if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_GOTREF(__pyx_t_17);
+ __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_25, &__pyx_t_24, &__pyx_t_15, &__pyx_t_10, NULL, __pyx_t_8);
+ if (unlikely(__pyx_t_6 == 0)) break;
+ if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alslist, __pyx_t_17);
- __Pyx_GIVEREF(__pyx_t_17);
- __pyx_t_17 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alslist, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156
+ /* "cdec/sa/rulefactory.pxi":1156
* for f, elist in fphrases.iteritems():
* for e, alslist in elist.iteritems():
* alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) # <<<<<<<<<<<<<<
* locs = tuple(itertools.chain.from_iterable(alslist.itervalues()))
* count = len(locs)
*/
- __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_15 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda5, 0, __pyx_n_s_input_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s_iteritems); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_key, __pyx_t_15) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_max, __pyx_t_17, __pyx_t_11); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
- PyObject* sequence = __pyx_t_15;
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
+ __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda7, 0, __pyx_n_s_input_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_max, __pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+ PyObject* sequence = __pyx_t_4;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -53243,52 +56575,52 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_10 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_15 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_11);
- __Pyx_INCREF(__pyx_t_17);
+ __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_15);
#else
- __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
+ __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
#endif
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_3 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext;
- index = 0; __pyx_t_11 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_11)) goto __pyx_L58_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
- index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_17)) goto __pyx_L58_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_17);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_20 = Py_TYPE(__pyx_t_18)->tp_iternext;
+ index = 0; __pyx_t_10 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_10)) goto __pyx_L58_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_10);
+ index = 1; __pyx_t_15 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_15)) goto __pyx_L58_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_15);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_18), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_20 = NULL;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
goto __pyx_L59_unpacking_done;
__pyx_L58_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
__pyx_t_20 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L59_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_max_locs);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_max_locs, __pyx_t_17);
- __Pyx_GIVEREF(__pyx_t_17);
- __pyx_t_17 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_max_locs, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1157
+ /* "cdec/sa/rulefactory.pxi":1157
* for e, alslist in elist.iteritems():
* alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1]))
* locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) # <<<<<<<<<<<<<<
@@ -53297,40 +56629,72 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_itertools); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_chain); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
+ __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_chain); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_from_iterable); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_from_iterable); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s_itervalues); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_17, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_alslist, __pyx_n_s_itervalues); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_17 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_18))) {
+ __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
+ if (likely(__pyx_t_17)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
+ __Pyx_INCREF(__pyx_t_17);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_18, function);
+ }
+ }
+ if (__pyx_t_17) {
+ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_17); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ } else {
+ __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_18); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_10);
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_18 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_18)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_18);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ }
+ }
+ if (!__pyx_t_18) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_17);
+ PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_18); __pyx_t_18 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_17, 0+1, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ __pyx_t_10 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_17, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_15, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
- __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_17, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_locs);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_locs, ((PyObject*)__pyx_t_11));
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_locs, ((PyObject*)__pyx_t_4));
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1158
+ /* "cdec/sa/rulefactory.pxi":1158
* alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1]))
* locs = tuple(itertools.chain.from_iterable(alslist.itervalues()))
* count = len(locs) # <<<<<<<<<<<<<<
@@ -53338,24 +56702,24 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
* f, e, count, fcount[f], num_samples,
*/
__pyx_t_26 = PyTuple_GET_SIZE(__pyx_cur_scope->__pyx_v_locs); if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_count, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1159
+ /* "cdec/sa/rulefactory.pxi":1159
* locs = tuple(itertools.chain.from_iterable(alslist.itervalues()))
* count = len(locs)
* scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
* f, e, count, fcount[f], num_samples,
* (k,i+spanlen), locs, input_match,
*/
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_FeatureContext); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_FeatureContext); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1160
+ /* "cdec/sa/rulefactory.pxi":1160
* count = len(locs)
* scores = self.scorer.score(FeatureContext(
* f, e, count, fcount[f], num_samples, # <<<<<<<<<<<<<<
@@ -53364,118 +56728,148 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_17);
- __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1161
+ /* "cdec/sa/rulefactory.pxi":1161
* scores = self.scorer.score(FeatureContext(
* f, e, count, fcount[f], num_samples,
* (k,i+spanlen), locs, input_match, # <<<<<<<<<<<<<<
* fwords, self.fda, self.eda,
* meta,
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_16 = PyNumber_Add(__pyx_t_1, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- __pyx_t_3 = 0;
- __pyx_t_16 = 0;
+ __pyx_t_11 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_18);
+ __Pyx_GIVEREF(__pyx_t_18);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_18 = 0;
+ __pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1165
+ /* "cdec/sa/rulefactory.pxi":1165
* meta,
* # Include online stats. None if none.
* self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<<
* # Phrase pair processed
* if self.online:
*/
- __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_online_ctx_lookup); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_online_ctx_lookup); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_19 = NULL;
+ __pyx_t_26 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_18))) {
+ __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
+ if (likely(__pyx_t_19)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
+ __Pyx_INCREF(__pyx_t_19);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_18, function);
+ __pyx_t_26 = 1;
+ }
+ }
+ __pyx_t_27 = PyTuple_New(3+__pyx_t_26); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ if (__pyx_t_19) {
+ PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_19); __pyx_t_19 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_27, 0+__pyx_t_26, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_27, 1+__pyx_t_26, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_ctx_name);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_cur_scope->__pyx_v_ctx_name);
+ PyTuple_SET_ITEM(__pyx_t_27, 2+__pyx_t_26, __pyx_cur_scope->__pyx_v_ctx_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name);
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_3, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1159
- * locs = tuple(itertools.chain.from_iterable(alslist.itervalues()))
- * count = len(locs)
- * scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
- * f, e, count, fcount[f], num_samples,
- * (k,i+spanlen), locs, input_match,
- */
- __pyx_t_3 = PyTuple_New(13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_27, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_18 = NULL;
+ __pyx_t_26 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_18)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_18);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_26 = 1;
+ }
+ }
+ __pyx_t_27 = PyTuple_New(13+__pyx_t_26); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ if (__pyx_t_18) {
+ PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_18); __pyx_t_18 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_27, 0+__pyx_t_26, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_27, 1+__pyx_t_26, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_count);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_cur_scope->__pyx_v_count);
+ PyTuple_SET_ITEM(__pyx_t_27, 2+__pyx_t_26, __pyx_cur_scope->__pyx_v_count);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_17);
+ PyTuple_SET_ITEM(__pyx_t_27, 3+__pyx_t_26, __pyx_t_17);
__Pyx_GIVEREF(__pyx_t_17);
- PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_15);
- __Pyx_GIVEREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_27, 4+__pyx_t_26, __pyx_t_10);
+ __Pyx_GIVEREF(__pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_27, 5+__pyx_t_26, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_locs);
- PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_cur_scope->__pyx_v_locs);
+ PyTuple_SET_ITEM(__pyx_t_27, 6+__pyx_t_26, __pyx_cur_scope->__pyx_v_locs);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_locs);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match);
- PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_cur_scope->__pyx_v_input_match);
+ PyTuple_SET_ITEM(__pyx_t_27, 7+__pyx_t_26, __pyx_cur_scope->__pyx_v_input_match);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_3, 8, __pyx_cur_scope->__pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_27, 8+__pyx_t_26, __pyx_cur_scope->__pyx_v_fwords);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
- PyTuple_SET_ITEM(__pyx_t_3, 9, ((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
+ PyTuple_SET_ITEM(__pyx_t_27, 9+__pyx_t_26, ((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
- PyTuple_SET_ITEM(__pyx_t_3, 10, ((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
+ PyTuple_SET_ITEM(__pyx_t_27, 10+__pyx_t_26, ((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_meta);
- PyTuple_SET_ITEM(__pyx_t_3, 11, __pyx_cur_scope->__pyx_v_meta);
+ PyTuple_SET_ITEM(__pyx_t_27, 11+__pyx_t_26, __pyx_cur_scope->__pyx_v_meta);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta);
- PyTuple_SET_ITEM(__pyx_t_3, 12, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_27, 12+__pyx_t_26, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
__pyx_t_17 = 0;
- __pyx_t_15 = 0;
- __pyx_t_1 = 0;
- __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_14)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_3));
- __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_10 = 0;
__pyx_t_3 = 0;
+ __pyx_t_11 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_27, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1159
+ * locs = tuple(itertools.chain.from_iterable(alslist.itervalues()))
+ * count = len(locs)
+ * scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
+ * f, e, count, fcount[f], num_samples,
+ * (k,i+spanlen), locs, input_match,
+ */
+ __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_4)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15));
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1167
+ /* "cdec/sa/rulefactory.pxi":1167
* self.online_ctx_lookup(f, e, ctx_name)))
* # Phrase pair processed
* if self.online: # <<<<<<<<<<<<<<
@@ -53485,67 +56879,67 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1168
+ /* "cdec/sa/rulefactory.pxi":1168
* # Phrase pair processed
* if self.online:
* seen_phrases.add((f, e)) # <<<<<<<<<<<<<<
* yield Rule(self.category, f, e, scores, alignment)
*
*/
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
- __pyx_t_12 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, __pyx_t_3); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_12 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, __pyx_t_15); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
goto __pyx_L60;
}
__pyx_L60:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1169
+ /* "cdec/sa/rulefactory.pxi":1169
* if self.online:
* seen_phrases.add((f, e))
* yield Rule(self.category, f, e, scores, alignment) # <<<<<<<<<<<<<<
*
* if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size:
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_14 = PyTuple_New(5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
- PyTuple_SET_ITEM(__pyx_t_14, 3, ((PyObject *)__pyx_cur_scope->__pyx_v_scores));
+ PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_cur_scope->__pyx_v_scores));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_alignment);
- PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_cur_scope->__pyx_v_alignment);
+ PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_cur_scope->__pyx_v_alignment);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
+ __pyx_t_15 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_r = __pyx_t_15;
+ __pyx_t_15 = 0;
+ __Pyx_XGIVEREF(__pyx_t_1);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
- __Pyx_XGIVEREF(__pyx_t_8);
__pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
- __Pyx_XGIVEREF(__pyx_t_10);
- __pyx_cur_scope->__pyx_t_4 = __pyx_t_10;
- __Pyx_XGIVEREF(__pyx_t_18);
- __pyx_cur_scope->__pyx_t_5 = __pyx_t_18;
+ __Pyx_XGIVEREF(__pyx_t_14);
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_14;
+ __Pyx_XGIVEREF(__pyx_t_16);
+ __pyx_cur_scope->__pyx_t_5 = __pyx_t_16;
__pyx_cur_scope->__pyx_t_6 = __pyx_t_21;
__pyx_cur_scope->__pyx_t_7 = __pyx_t_23;
__pyx_cur_scope->__pyx_t_8 = __pyx_t_24;
@@ -53556,27 +56950,27 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_generator->resume_label = 1;
return __pyx_r;
__pyx_L61_resume_from_yield:;
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_1);
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
__pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = 0;
- __Pyx_XGOTREF(__pyx_t_8);
- __pyx_t_10 = __pyx_cur_scope->__pyx_t_4;
+ __pyx_t_14 = __pyx_cur_scope->__pyx_t_4;
__pyx_cur_scope->__pyx_t_4 = 0;
- __Pyx_XGOTREF(__pyx_t_10);
- __pyx_t_18 = __pyx_cur_scope->__pyx_t_5;
+ __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_t_16 = __pyx_cur_scope->__pyx_t_5;
__pyx_cur_scope->__pyx_t_5 = 0;
- __Pyx_XGOTREF(__pyx_t_18);
+ __Pyx_XGOTREF(__pyx_t_16);
__pyx_t_21 = __pyx_cur_scope->__pyx_t_6;
__pyx_t_23 = __pyx_cur_scope->__pyx_t_7;
__pyx_t_24 = __pyx_cur_scope->__pyx_t_8;
__pyx_t_25 = __pyx_cur_scope->__pyx_t_9;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
goto __pyx_L47;
}
__pyx_L47:;
@@ -53587,7 +56981,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
__pyx_L32:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1171
+ /* "cdec/sa/rulefactory.pxi":1171
* yield Rule(self.category, f, e, scores, alignment)
*
* if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size: # <<<<<<<<<<<<<<
@@ -53595,113 +56989,119 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
* new_frontier.append((k, i+spanlen, input_match, alt_id, pathlen + 1, node, phrase, is_shadow_path))
*/
__pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = (__pyx_t_23 < __pyx_cur_scope->__pyx_v_self->max_length);
- if (__pyx_t_9) {
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = __pyx_cur_scope->__pyx_v_fwords;
- __Pyx_INCREF(__pyx_t_18);
- __pyx_t_23 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_t_18, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_13) {
- __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_18, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_27 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_28 = __pyx_t_27;
- } else {
- __pyx_t_28 = __pyx_t_13;
- }
- __pyx_t_13 = __pyx_t_28;
+ __pyx_t_13 = ((__pyx_t_23 < __pyx_cur_scope->__pyx_v_self->max_length) != 0);
+ if (__pyx_t_13) {
+ goto __pyx_L64_next_and;
} else {
- __pyx_t_13 = __pyx_t_9;
+ __pyx_t_9 = __pyx_t_13;
+ goto __pyx_L63_bool_binop_done;
}
+ __pyx_L64_next_and:;
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_1 = PyNumber_Add(__pyx_t_16, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = __pyx_cur_scope->__pyx_v_fwords;
+ __Pyx_INCREF(__pyx_t_16);
+ __pyx_t_23 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = PyObject_RichCompare(__pyx_t_1, __pyx_t_16, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (__pyx_t_13) {
+ goto __pyx_L65_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_13;
+ goto __pyx_L63_bool_binop_done;
+ }
+ __pyx_L65_next_and:;
+ __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_1 = PyObject_RichCompare(__pyx_t_15, __pyx_t_16, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = __pyx_t_13;
+ __pyx_L63_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1172
+ /* "cdec/sa/rulefactory.pxi":1172
*
* if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size:
* for alt_id in range(len(fwords[i+spanlen])): # <<<<<<<<<<<<<<
* new_frontier.append((k, i+spanlen, input_match, alt_id, pathlen + 1, node, phrase, is_shadow_path))
* num_subpatterns = arity
*/
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __pyx_t_10 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_10);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_23 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_16 = PyNumber_Add(__pyx_t_1, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_16); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_23 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_23; __pyx_t_21+=1) {
__pyx_cur_scope->__pyx_v_alt_id = __pyx_t_21;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1173
+ /* "cdec/sa/rulefactory.pxi":1173
* if len(phrase) < self.max_length and i+spanlen < len(fwords) and pathlen+1 <= self.max_initial_size:
* for alt_id in range(len(fwords[i+spanlen])):
* new_frontier.append((k, i+spanlen, input_match, alt_id, pathlen + 1, node, phrase, is_shadow_path)) # <<<<<<<<<<<<<<
* num_subpatterns = arity
* if not is_shadow_path:
*/
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_3 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_14 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_15 = PyNumber_Add(__pyx_t_16, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_4 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_27 = PyTuple_New(8); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_27, 1, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match);
- PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_cur_scope->__pyx_v_input_match);
+ PyTuple_SET_ITEM(__pyx_t_27, 2, __pyx_cur_scope->__pyx_v_input_match);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match);
- PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_27, 3, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ PyTuple_SET_ITEM(__pyx_t_27, 4, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_node);
- PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_cur_scope->__pyx_v_node);
+ PyTuple_SET_ITEM(__pyx_t_27, 5, __pyx_cur_scope->__pyx_v_node);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_node);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase);
- PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_cur_scope->__pyx_v_phrase);
+ PyTuple_SET_ITEM(__pyx_t_27, 6, __pyx_cur_scope->__pyx_v_phrase);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
- PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_cur_scope->__pyx_v_is_shadow_path);
+ PyTuple_SET_ITEM(__pyx_t_27, 7, __pyx_cur_scope->__pyx_v_is_shadow_path);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
- __pyx_t_10 = 0;
- __pyx_t_3 = 0;
- __pyx_t_18 = 0;
- __pyx_t_14 = 0;
- __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, __pyx_t_11); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_1 = 0;
+ __pyx_t_15 = 0;
+ __pyx_t_16 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, __pyx_t_27); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1174
+ /* "cdec/sa/rulefactory.pxi":1174
* for alt_id in range(len(fwords[i+spanlen])):
* new_frontier.append((k, i+spanlen, input_match, alt_id, pathlen + 1, node, phrase, is_shadow_path))
* num_subpatterns = arity # <<<<<<<<<<<<<<
@@ -53710,18 +57110,18 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1175
+ /* "cdec/sa/rulefactory.pxi":1175
* new_frontier.append((k, i+spanlen, input_match, alt_id, pathlen + 1, node, phrase, is_shadow_path))
* num_subpatterns = arity
* if not is_shadow_path: # <<<<<<<<<<<<<<
* num_subpatterns = num_subpatterns + 1
* if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks:
*/
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = ((!__pyx_t_13) != 0);
- if (__pyx_t_9) {
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = ((!__pyx_t_9) != 0);
+ if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1176
+ /* "cdec/sa/rulefactory.pxi":1176
* num_subpatterns = arity
* if not is_shadow_path:
* num_subpatterns = num_subpatterns + 1 # <<<<<<<<<<<<<<
@@ -53729,11 +57129,11 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
* xcat = sym_setindex(self.category, arity+1)
*/
__pyx_cur_scope->__pyx_v_num_subpatterns = (__pyx_cur_scope->__pyx_v_num_subpatterns + 1);
- goto __pyx_L65;
+ goto __pyx_L68;
}
- __pyx_L65:;
+ __pyx_L68:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1177
+ /* "cdec/sa/rulefactory.pxi":1177
* if not is_shadow_path:
* num_subpatterns = num_subpatterns + 1
* if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks: # <<<<<<<<<<<<<<
@@ -53743,20 +57143,26 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_9 = (((__pyx_t_23 + 1) < __pyx_cur_scope->__pyx_v_self->max_length) != 0);
if (__pyx_t_9) {
- __pyx_t_13 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0);
- if (__pyx_t_13) {
- __pyx_t_28 = ((__pyx_cur_scope->__pyx_v_num_subpatterns < __pyx_cur_scope->__pyx_v_self->max_chunks) != 0);
- __pyx_t_27 = __pyx_t_28;
- } else {
- __pyx_t_27 = __pyx_t_13;
- }
- __pyx_t_13 = __pyx_t_27;
+ goto __pyx_L71_next_and;
} else {
__pyx_t_13 = __pyx_t_9;
+ goto __pyx_L70_bool_binop_done;
}
+ __pyx_L71_next_and:;
+ __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0);
+ if (__pyx_t_9) {
+ goto __pyx_L72_next_and;
+ } else {
+ __pyx_t_13 = __pyx_t_9;
+ goto __pyx_L70_bool_binop_done;
+ }
+ __pyx_L72_next_and:;
+ __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_num_subpatterns < __pyx_cur_scope->__pyx_v_self->max_chunks) != 0);
+ __pyx_t_13 = __pyx_t_9;
+ __pyx_L70_bool_binop_done:;
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1178
+ /* "cdec/sa/rulefactory.pxi":1178
* num_subpatterns = num_subpatterns + 1
* if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks:
* xcat = sym_setindex(self.category, arity+1) # <<<<<<<<<<<<<<
@@ -53765,71 +57171,71 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_cur_scope->__pyx_v_xcat = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, (__pyx_cur_scope->__pyx_v_arity + 1));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1179
+ /* "cdec/sa/rulefactory.pxi":1179
* if len(phrase)+1 < self.max_length and arity < self.max_nonterminals and num_subpatterns < self.max_chunks:
* xcat = sym_setindex(self.category, arity+1)
* xnode = node.children[xcat] # <<<<<<<<<<<<<<
* # I put spanlen=1 below
* key = tuple([self.min_gap_size, i, 1, pathlen])
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_xcat, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s_children); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_27, __pyx_cur_scope->__pyx_v_xcat, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xnode, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
- __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_xnode, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1181
+ /* "cdec/sa/rulefactory.pxi":1181
* xnode = node.children[xcat]
* # I put spanlen=1 below
* key = tuple([self.min_gap_size, i, 1, pathlen]) # <<<<<<<<<<<<<<
* frontier_nodes = []
* if key in nodes_isteps_away_buffer:
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_18 = PyList_New(4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyList_SET_ITEM(__pyx_t_18, 0, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
- PyList_SET_ITEM(__pyx_t_18, 1, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __pyx_t_16 = PyList_New(4); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ PyList_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_27);
+ __Pyx_GIVEREF(__pyx_t_27);
__Pyx_INCREF(__pyx_int_1);
- PyList_SET_ITEM(__pyx_t_18, 2, __pyx_int_1);
+ PyList_SET_ITEM(__pyx_t_16, 2, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen);
- PyList_SET_ITEM(__pyx_t_18, 3, __pyx_cur_scope->__pyx_v_pathlen);
+ PyList_SET_ITEM(__pyx_t_16, 3, __pyx_cur_scope->__pyx_v_pathlen);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen);
- __pyx_t_14 = 0;
- __pyx_t_11 = 0;
- __pyx_t_11 = PyList_AsTuple(((PyObject*)__pyx_t_18)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_27 = 0;
+ __pyx_t_27 = PyList_AsTuple(((PyObject*)__pyx_t_16)); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, ((PyObject*)__pyx_t_11));
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, ((PyObject*)__pyx_t_27));
+ __Pyx_GIVEREF(__pyx_t_27);
+ __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1182
+ /* "cdec/sa/rulefactory.pxi":1182
* # I put spanlen=1 below
* key = tuple([self.min_gap_size, i, 1, pathlen])
* frontier_nodes = [] # <<<<<<<<<<<<<<
* if key in nodes_isteps_away_buffer:
* frontier_nodes = nodes_isteps_away_buffer[key]
*/
- __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_27 = PyList_New(0); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_27);
+ __Pyx_GIVEREF(__pyx_t_27);
+ __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1183
+ /* "cdec/sa/rulefactory.pxi":1183
* key = tuple([self.min_gap_size, i, 1, pathlen])
* frontier_nodes = []
* if key in nodes_isteps_away_buffer: # <<<<<<<<<<<<<<
@@ -53840,69 +57246,84 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = (__pyx_t_13 != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1184
+ /* "cdec/sa/rulefactory.pxi":1184
* frontier_nodes = []
* if key in nodes_isteps_away_buffer:
* frontier_nodes = nodes_isteps_away_buffer[key] # <<<<<<<<<<<<<<
* else:
* frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer)
*/
- __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer, __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_27 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer, __pyx_cur_scope->__pyx_v_key); if (unlikely(__pyx_t_27 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_27);
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_t_11 = 0;
- goto __pyx_L67;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_27);
+ __Pyx_GIVEREF(__pyx_t_27);
+ __pyx_t_27 = 0;
+ goto __pyx_L73;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1186
+ /* "cdec/sa/rulefactory.pxi":1186
* frontier_nodes = nodes_isteps_away_buffer[key]
* else:
* frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer) # <<<<<<<<<<<<<<
* nodes_isteps_away_buffer[key] = frontier_nodes
*
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_all_nodes_isteps_away); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_all_nodes_isteps_away); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_1 = NULL;
+ __pyx_t_23 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
+ __pyx_t_23 = 1;
+ }
+ }
+ __pyx_t_11 = PyTuple_New(7+__pyx_t_23); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
+ if (__pyx_t_1) {
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
+ }
+ PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_23, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_23, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_int_1);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_1);
+ PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_23, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_cur_scope->__pyx_v_pathlen);
+ PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_23, __pyx_cur_scope->__pyx_v_pathlen);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_cur_scope->__pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_23, __pyx_cur_scope->__pyx_v_fwords);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_next_states);
- PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_cur_scope->__pyx_v_next_states);
+ PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_23, __pyx_cur_scope->__pyx_v_next_states);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_next_states);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_reachable_buffer);
- PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_cur_scope->__pyx_v_reachable_buffer);
+ PyTuple_SET_ITEM(__pyx_t_11, 6+__pyx_t_23, __pyx_cur_scope->__pyx_v_reachable_buffer);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reachable_buffer);
- __pyx_t_18 = 0;
- __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = 0;
+ __pyx_t_15 = 0;
+ __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_11, NULL); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
- __pyx_t_14 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_frontier_nodes, __pyx_t_27);
+ __Pyx_GIVEREF(__pyx_t_27);
+ __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1187
+ /* "cdec/sa/rulefactory.pxi":1187
* else:
* frontier_nodes = self.get_all_nodes_isteps_away(self.min_gap_size, i, 1, pathlen, fwords, next_states, reachable_buffer)
* nodes_isteps_away_buffer[key] = frontier_nodes # <<<<<<<<<<<<<<
@@ -53911,41 +57332,43 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer, __pyx_cur_scope->__pyx_v_key, __pyx_cur_scope->__pyx_v_frontier_nodes) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L67:;
+ __pyx_L73:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1189
+ /* "cdec/sa/rulefactory.pxi":1189
* nodes_isteps_away_buffer[key] = frontier_nodes
*
* for i, alt, pathlen in frontier_nodes: # <<<<<<<<<<<<<<
* new_frontier.append((k, i, input_match + (i,), alt, pathlen, xnode, phrase +(xcat,), is_shadow_path))
* frontier = new_frontier
*/
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes)) {
- __pyx_t_14 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_14); __pyx_t_23 = 0;
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_frontier_nodes)) {
+ __pyx_t_27 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_27); __pyx_t_23 = 0;
__pyx_t_22 = NULL;
} else {
- __pyx_t_23 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_22 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __pyx_t_23 = -1; __pyx_t_27 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __pyx_t_22 = Py_TYPE(__pyx_t_27)->tp_iternext; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_22)) {
+ if (likely(PyList_CheckExact(__pyx_t_27))) {
+ if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_27)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_16 = PyList_GET_ITEM(__pyx_t_27, __pyx_t_23); __Pyx_INCREF(__pyx_t_16); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_16 = PySequence_ITEM(__pyx_t_27, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_27)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_27, __pyx_t_23); __Pyx_INCREF(__pyx_t_16); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_16 = PySequence_ITEM(__pyx_t_27, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_22(__pyx_t_14);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_16 = __pyx_t_22(__pyx_t_27);
+ if (unlikely(!__pyx_t_16)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -53953,10 +57376,10 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_16);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ if ((likely(PyTuple_CheckExact(__pyx_t_16))) || (PyList_CheckExact(__pyx_t_16))) {
+ PyObject* sequence = __pyx_t_16;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -53970,133 +57393,149 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
} else {
__pyx_t_11 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_10 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_15 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
}
__Pyx_INCREF(__pyx_t_11);
- __Pyx_INCREF(__pyx_t_18);
- __Pyx_INCREF(__pyx_t_10);
+ __Pyx_INCREF(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_18 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
+ __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_20 = Py_TYPE(__pyx_t_1)->tp_iternext;
- index = 0; __pyx_t_11 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L70_unpacking_failed;
+ index = 0; __pyx_t_11 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L76_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
- index = 1; __pyx_t_18 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_18)) goto __pyx_L70_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_18);
- index = 2; __pyx_t_10 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_10)) goto __pyx_L70_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_10);
+ index = 1; __pyx_t_15 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L76_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_15);
+ index = 2; __pyx_t_4 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L76_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_1), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_20 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L71_unpacking_done;
- __pyx_L70_unpacking_failed:;
+ goto __pyx_L77_unpacking_done;
+ __pyx_L76_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_20 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L71_unpacking_done:;
+ __pyx_L77_unpacking_done:;
}
__pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_cur_scope->__pyx_v_i = __pyx_t_21;
- __pyx_cur_scope->__pyx_v_alt = __pyx_t_7;
+ __pyx_cur_scope->__pyx_v_alt = __pyx_t_8;
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pathlen, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- __pyx_t_10 = 0;
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_pathlen, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1190
+ /* "cdec/sa/rulefactory.pxi":1190
*
* for i, alt, pathlen in frontier_nodes:
* new_frontier.append((k, i, input_match + (i,), alt, pathlen, xnode, phrase +(xcat,), is_shadow_path)) # <<<<<<<<<<<<<<
* frontier = new_frontier
*
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_10);
- __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
- __pyx_t_18 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, __pyx_t_11); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ __pyx_t_15 = 0;
+ __pyx_t_15 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, __pyx_t_11); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = PyTuple_New(8); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_10);
- __Pyx_GIVEREF(__pyx_t_10);
- PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_11);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyTuple_New(8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
+ PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen);
- PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_cur_scope->__pyx_v_pathlen);
+ PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_cur_scope->__pyx_v_pathlen);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_xnode);
- PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_cur_scope->__pyx_v_xnode);
+ PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_cur_scope->__pyx_v_xnode);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xnode);
- PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
- PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_cur_scope->__pyx_v_is_shadow_path);
+ PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_cur_scope->__pyx_v_is_shadow_path);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path);
- __pyx_t_3 = 0;
- __pyx_t_10 = 0;
- __pyx_t_18 = 0;
+ __pyx_t_16 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_15 = 0;
__pyx_t_11 = 0;
__pyx_t_1 = 0;
- __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, __pyx_t_15); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, __pyx_t_3); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1189
+ * nodes_isteps_away_buffer[key] = frontier_nodes
+ *
+ * for i, alt, pathlen in frontier_nodes: # <<<<<<<<<<<<<<
+ * new_frontier.append((k, i, input_match + (i,), alt, pathlen, xnode, phrase +(xcat,), is_shadow_path))
+ * frontier = new_frontier
+ */
}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L66;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ goto __pyx_L69;
}
- __pyx_L66:;
+ __pyx_L69:;
goto __pyx_L62;
}
__pyx_L62:;
+
+ /* "cdec/sa/rulefactory.pxi":1033
+ * while len(frontier) > 0:
+ * new_frontier = []
+ * for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: # <<<<<<<<<<<<<<
+ * word_id = fwords[i][alt][0]
+ * spanlen = fwords[i][alt][2]
+ */
__pyx_L19_continue:;
}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1191
+ /* "cdec/sa/rulefactory.pxi":1191
* for i, alt, pathlen in frontier_nodes:
* new_frontier.append((k, i, input_match + (i,), alt, pathlen, xnode, phrase +(xcat,), is_shadow_path))
* frontier = new_frontier # <<<<<<<<<<<<<<
@@ -54109,7 +57548,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_frontier);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1194
+ /* "cdec/sa/rulefactory.pxi":1194
*
* # Online rule extraction and scoring
* if self.online: # <<<<<<<<<<<<<<
@@ -54119,85 +57558,103 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1195
+ /* "cdec/sa/rulefactory.pxi":1195
* # Online rule extraction and scoring
* if self.online:
* stats = self.online_stats[ctx_name] # <<<<<<<<<<<<<<
* f_syms = tuple(word[0][0] for word in fwords)
* for f, lex_i, lex_j in self.get_f_phrases(f_syms):
*/
- __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_cur_scope->__pyx_v_ctx_name); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_cur_scope->__pyx_v_stats = __pyx_t_8;
- __pyx_t_8 = 0;
+ __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_cur_scope->__pyx_v_ctx_name); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_cur_scope->__pyx_v_stats = __pyx_t_14;
+ __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196
+ /* "cdec/sa/rulefactory.pxi":1196
* if self.online:
* stats = self.online_stats[ctx_name]
* f_syms = tuple(word[0][0] for word in fwords) # <<<<<<<<<<<<<<
* for f, lex_i, lex_j in self.get_f_phrases(f_syms):
* spanlen = (lex_j - lex_i) + 1
*/
- __pyx_t_8 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_cur_scope->__pyx_v_f_syms = ((PyObject*)__pyx_t_8);
- __pyx_t_8 = 0;
+ __pyx_t_27 = PyTuple_New(1); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_t_14 = 0;
+ __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_27, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_cur_scope->__pyx_v_f_syms = ((PyObject*)__pyx_t_14);
+ __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1197
+ /* "cdec/sa/rulefactory.pxi":1197
* stats = self.online_stats[ctx_name]
* f_syms = tuple(word[0][0] for word in fwords)
* for f, lex_i, lex_j in self.get_f_phrases(f_syms): # <<<<<<<<<<<<<<
* spanlen = (lex_j - lex_i) + 1
* if not sym_isvar(f[0]):
*/
- __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_f_phrases); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_syms);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_cur_scope->__pyx_v_f_syms);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_syms);
- __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (PyList_CheckExact(__pyx_t_15) || PyTuple_CheckExact(__pyx_t_15)) {
- __pyx_t_14 = __pyx_t_15; __Pyx_INCREF(__pyx_t_14); __pyx_t_2 = 0;
- __pyx_t_22 = NULL;
+ __pyx_t_27 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_f_phrases); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_27))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_27);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_27, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_27, __pyx_cur_scope->__pyx_v_f_syms); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
} else {
- __pyx_t_2 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_syms);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_cur_scope->__pyx_v_f_syms);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_syms);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_1, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_22 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) {
+ __pyx_t_27 = __pyx_t_14; __Pyx_INCREF(__pyx_t_27); __pyx_t_2 = 0;
+ __pyx_t_22 = NULL;
+ } else {
+ __pyx_t_2 = -1; __pyx_t_27 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __pyx_t_22 = Py_TYPE(__pyx_t_27)->tp_iternext; if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
for (;;) {
- if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_2); __Pyx_INCREF(__pyx_t_15); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_2); __Pyx_INCREF(__pyx_t_15); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_22)) {
+ if (likely(PyList_CheckExact(__pyx_t_27))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_27)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_27, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_27, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_27)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_27, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_27, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_15 = __pyx_t_22(__pyx_t_14);
- if (unlikely(!__pyx_t_15)) {
+ __pyx_t_14 = __pyx_t_22(__pyx_t_27);
+ if (unlikely(!__pyx_t_14)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -54205,10 +57662,10 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
break;
}
- __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_14);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
- PyObject* sequence = __pyx_t_15;
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -54221,80 +57678,80 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
} else {
- __pyx_t_8 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_1 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
__pyx_t_11 = PyList_GET_ITEM(sequence, 2);
}
- __Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_11);
#else
- __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
#endif
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_18 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_20 = Py_TYPE(__pyx_t_18)->tp_iternext;
- index = 0; __pyx_t_8 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_8)) goto __pyx_L75_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_8);
- index = 1; __pyx_t_1 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_1)) goto __pyx_L75_unpacking_failed;
+ __pyx_t_15 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_20 = Py_TYPE(__pyx_t_15)->tp_iternext;
+ index = 0; __pyx_t_1 = __pyx_t_20(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L81_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
- index = 2; __pyx_t_11 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_11)) goto __pyx_L75_unpacking_failed;
+ index = 1; __pyx_t_3 = __pyx_t_20(__pyx_t_15); if (unlikely(!__pyx_t_3)) goto __pyx_L81_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 2; __pyx_t_11 = __pyx_t_20(__pyx_t_15); if (unlikely(!__pyx_t_11)) goto __pyx_L81_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_18), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_15), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_20 = NULL;
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- goto __pyx_L76_unpacking_done;
- __pyx_L75_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L82_unpacking_done;
+ __pyx_L81_unpacking_failed:;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_20 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L76_unpacking_done:;
+ __pyx_L82_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_i);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex_i, __pyx_t_1);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_f, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
+ __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_i);
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex_i, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_j);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_lex_j, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1198
+ /* "cdec/sa/rulefactory.pxi":1198
* f_syms = tuple(word[0][0] for word in fwords)
* for f, lex_i, lex_j in self.get_f_phrases(f_syms):
* spanlen = (lex_j - lex_i) + 1 # <<<<<<<<<<<<<<
* if not sym_isvar(f[0]):
* spanlen += 1
*/
- __pyx_t_15 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_11 = PyNumber_Add(__pyx_t_15, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_11 = PyNumber_Add(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1199
+ /* "cdec/sa/rulefactory.pxi":1199
* for f, lex_i, lex_j in self.get_f_phrases(f_syms):
* spanlen = (lex_j - lex_i) + 1
* if not sym_isvar(f[0]): # <<<<<<<<<<<<<<
@@ -54303,12 +57760,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0);
+ __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_8) != 0)) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1200
+ /* "cdec/sa/rulefactory.pxi":1200
* spanlen = (lex_j - lex_i) + 1
* if not sym_isvar(f[0]):
* spanlen += 1 # <<<<<<<<<<<<<<
@@ -54321,11 +57778,11 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
- goto __pyx_L77;
+ goto __pyx_L83;
}
- __pyx_L77:;
+ __pyx_L83:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1201
+ /* "cdec/sa/rulefactory.pxi":1201
* if not sym_isvar(f[0]):
* spanlen += 1
* if not sym_isvar(f[1]): # <<<<<<<<<<<<<<
@@ -54334,12 +57791,12 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_11);
- __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0);
+ __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_8) != 0)) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1202
+ /* "cdec/sa/rulefactory.pxi":1202
* spanlen += 1
* if not sym_isvar(f[1]):
* spanlen += 1 # <<<<<<<<<<<<<<
@@ -54352,61 +57809,78 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_spanlen, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
- goto __pyx_L78;
+ goto __pyx_L84;
}
- __pyx_L78:;
+ __pyx_L84:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1203
+ /* "cdec/sa/rulefactory.pxi":1203
* if not sym_isvar(f[1]):
* spanlen += 1
* for e in stats.phrases_fe.get(f, ()): # <<<<<<<<<<<<<<
* if (f, e) not in seen_phrases:
* # Don't add multiple instances of the same phrase here
*/
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_get); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ __pyx_t_23 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_23 = 1;
+ }
+ }
+ __pyx_t_1 = PyTuple_New(2+__pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (__pyx_t_14) {
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_23, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_empty_tuple);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_empty_tuple);
+ PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_23, __pyx_empty_tuple);
__Pyx_GIVEREF(__pyx_empty_tuple);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
- __pyx_t_11 = __pyx_t_1; __Pyx_INCREF(__pyx_t_11); __pyx_t_23 = 0;
- __pyx_t_29 = NULL;
+ __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
+ __pyx_t_3 = __pyx_t_11; __Pyx_INCREF(__pyx_t_3); __pyx_t_23 = 0;
+ __pyx_t_28 = NULL;
} else {
- __pyx_t_23 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_29 = Py_TYPE(__pyx_t_11)->tp_iternext;
+ __pyx_t_23 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_28 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
for (;;) {
- if (!__pyx_t_29 && PyList_CheckExact(__pyx_t_11)) {
- if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_11)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_23); __Pyx_INCREF(__pyx_t_1); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_11, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_29 && PyTuple_CheckExact(__pyx_t_11)) {
- if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_23); __Pyx_INCREF(__pyx_t_1); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_11, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_28)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_11 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_11 = PySequence_ITEM(__pyx_t_3, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_11 = PySequence_ITEM(__pyx_t_3, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_29(__pyx_t_11);
- if (unlikely(!__pyx_t_1)) {
+ __pyx_t_11 = __pyx_t_28(__pyx_t_3);
+ if (unlikely(!__pyx_t_11)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
@@ -54414,52 +57888,52 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
}
break;
}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_11);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1204
+ /* "cdec/sa/rulefactory.pxi":1204
* spanlen += 1
* for e in stats.phrases_fe.get(f, ()):
* if (f, e) not in seen_phrases: # <<<<<<<<<<<<<<
* # Don't add multiple instances of the same phrase here
* seen_phrases.add((f, e))
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
- __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_cur_scope->__pyx_v_seen_phrases, Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_11, __pyx_cur_scope->__pyx_v_seen_phrases, Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_13 = (__pyx_t_9 != 0);
if (__pyx_t_13) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1206
+ /* "cdec/sa/rulefactory.pxi":1206
* if (f, e) not in seen_phrases:
* # Don't add multiple instances of the same phrase here
* seen_phrases.add((f, e)) # <<<<<<<<<<<<<<
* scores = self.scorer.score(FeatureContext(
* f, e, 0, 0, 0,
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
- __pyx_t_12 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, __pyx_t_1); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_12 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, __pyx_t_11); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1207
+ /* "cdec/sa/rulefactory.pxi":1207
* # Don't add multiple instances of the same phrase here
* seen_phrases.add((f, e))
* scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
@@ -54469,7 +57943,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_FeatureContext); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1212
+ /* "cdec/sa/rulefactory.pxi":1212
* fwords, self.fda, self.eda,
* meta,
* self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<<
@@ -54478,290 +57952,411 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
*/
__pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_online_ctx_lookup); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_4 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_ctx_name);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_cur_scope->__pyx_v_ctx_name);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_cur_scope->__pyx_v_ctx_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name);
- __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_8, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1207
- * # Don't add multiple instances of the same phrase here
- * seen_phrases.add((f, e))
- * scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
- * f, e, 0, 0, 0,
- * spanlen, None, None,
- */
- __pyx_t_8 = PyTuple_New(13); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = NULL;
+ __pyx_t_7 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_15)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_15);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(13+__pyx_t_7); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_15) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_7, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_7, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_spanlen);
- PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_cur_scope->__pyx_v_spanlen);
+ PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_7, __pyx_cur_scope->__pyx_v_spanlen);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_spanlen);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_8, 6, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_16, 6+__pyx_t_7, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_8, 7, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_16, 7+__pyx_t_7, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords);
- PyTuple_SET_ITEM(__pyx_t_8, 8, __pyx_cur_scope->__pyx_v_fwords);
+ PyTuple_SET_ITEM(__pyx_t_16, 8+__pyx_t_7, __pyx_cur_scope->__pyx_v_fwords);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
- PyTuple_SET_ITEM(__pyx_t_8, 9, ((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
+ PyTuple_SET_ITEM(__pyx_t_16, 9+__pyx_t_7, ((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->fda));
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
- PyTuple_SET_ITEM(__pyx_t_8, 10, ((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
+ PyTuple_SET_ITEM(__pyx_t_16, 10+__pyx_t_7, ((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->eda));
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_meta);
- PyTuple_SET_ITEM(__pyx_t_8, 11, __pyx_cur_scope->__pyx_v_meta);
+ PyTuple_SET_ITEM(__pyx_t_16, 11+__pyx_t_7, __pyx_cur_scope->__pyx_v_meta);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta);
- PyTuple_SET_ITEM(__pyx_t_8, 12, __pyx_t_18);
- __Pyx_GIVEREF(__pyx_t_18);
- __pyx_t_18 = 0;
- __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
+ PyTuple_SET_ITEM(__pyx_t_16, 12+__pyx_t_7, __pyx_t_14);
+ __Pyx_GIVEREF(__pyx_t_14);
+ __pyx_t_14 = 0;
+ __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1207
+ * # Don't add multiple instances of the same phrase here
+ * seen_phrases.add((f, e))
+ * scores = self.scorer.score(FeatureContext( # <<<<<<<<<<<<<<
+ * f, e, 0, 0, 0,
+ * spanlen, None, None,
+ */
+ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_8));
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_scores, ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_1));
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1213
+ /* "cdec/sa/rulefactory.pxi":1213
* meta,
* self.online_ctx_lookup(f, e, ctx_name)))
* alignment = stats.phrases_al[f][e] # <<<<<<<<<<<<<<
* yield Rule(self.category, f, e, scores, alignment)
*
*/
- __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_18 = PyObject_GetItem(__pyx_t_8, __pyx_cur_scope->__pyx_v_f); if (unlikely(__pyx_t_18 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_18);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_e); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_f); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyObject_GetItem(__pyx_t_11, __pyx_cur_scope->__pyx_v_e); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment);
- __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
+ __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_alignment, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1214
+ /* "cdec/sa/rulefactory.pxi":1214
* self.online_ctx_lookup(f, e, ctx_name)))
* alignment = stats.phrases_al[f][e]
* yield Rule(self.category, f, e, scores, alignment) # <<<<<<<<<<<<<<
*
* stop_time = monitor_cpu()
*/
- __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_18 = PyTuple_New(5); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_18);
- PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_11 = PyTuple_New(5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_cur_scope->__pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_cur_scope->__pyx_v_f);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_cur_scope->__pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_cur_scope->__pyx_v_e);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e);
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
- PyTuple_SET_ITEM(__pyx_t_18, 3, ((PyObject *)__pyx_cur_scope->__pyx_v_scores));
+ PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)__pyx_cur_scope->__pyx_v_scores));
__Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores));
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_alignment);
- PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_cur_scope->__pyx_v_alignment);
+ PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_cur_scope->__pyx_v_alignment);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), __pyx_t_18, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_r = __pyx_t_8;
- __pyx_t_8 = 0;
- __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
- __Pyx_XGIVEREF(__pyx_t_11);
- __pyx_cur_scope->__pyx_t_3 = __pyx_t_11;
- __Pyx_XGIVEREF(__pyx_t_14);
- __pyx_cur_scope->__pyx_t_4 = __pyx_t_14;
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
__pyx_cur_scope->__pyx_t_10 = __pyx_t_22;
- __pyx_cur_scope->__pyx_t_1 = __pyx_t_23;
- __pyx_cur_scope->__pyx_t_11 = __pyx_t_29;
+ __pyx_cur_scope->__pyx_t_2 = __pyx_t_23;
+ __Pyx_XGIVEREF(__pyx_t_27);
+ __pyx_cur_scope->__pyx_t_4 = __pyx_t_27;
+ __pyx_cur_scope->__pyx_t_11 = __pyx_t_28;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
/* return from generator, yielding value */
__pyx_generator->resume_label = 2;
return __pyx_r;
- __pyx_L82_resume_from_yield:;
- __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
- __pyx_t_11 = __pyx_cur_scope->__pyx_t_3;
- __pyx_cur_scope->__pyx_t_3 = 0;
- __Pyx_XGOTREF(__pyx_t_11);
- __pyx_t_14 = __pyx_cur_scope->__pyx_t_4;
- __pyx_cur_scope->__pyx_t_4 = 0;
- __Pyx_XGOTREF(__pyx_t_14);
+ __pyx_L88_resume_from_yield:;
+ __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
+ __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
+ __pyx_cur_scope->__pyx_t_0 = 0;
+ __Pyx_XGOTREF(__pyx_t_3);
__pyx_t_22 = __pyx_cur_scope->__pyx_t_10;
- __pyx_t_23 = __pyx_cur_scope->__pyx_t_1;
- __pyx_t_29 = __pyx_cur_scope->__pyx_t_11;
+ __pyx_t_23 = __pyx_cur_scope->__pyx_t_2;
+ __pyx_t_27 = __pyx_cur_scope->__pyx_t_4;
+ __pyx_cur_scope->__pyx_t_4 = 0;
+ __Pyx_XGOTREF(__pyx_t_27);
+ __pyx_t_28 = __pyx_cur_scope->__pyx_t_11;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L81;
+ goto __pyx_L87;
}
- __pyx_L81:;
+ __pyx_L87:;
+
+ /* "cdec/sa/rulefactory.pxi":1203
+ * if not sym_isvar(f[1]):
+ * spanlen += 1
+ * for e in stats.phrases_fe.get(f, ()): # <<<<<<<<<<<<<<
+ * if (f, e) not in seen_phrases:
+ * # Don't add multiple instances of the same phrase here
+ */
}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1197
+ * stats = self.online_stats[ctx_name]
+ * f_syms = tuple(word[0][0] for word in fwords)
+ * for f, lex_i, lex_j in self.get_f_phrases(f_syms): # <<<<<<<<<<<<<<
+ * spanlen = (lex_j - lex_i) + 1
+ * if not sym_isvar(f[0]):
+ */
}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L72;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
+ goto __pyx_L78;
}
- __pyx_L72:;
+ __pyx_L78:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1216
+ /* "cdec/sa/rulefactory.pxi":1216
* yield Rule(self.category, f, e, scores, alignment)
*
* stop_time = monitor_cpu() # <<<<<<<<<<<<<<
* logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time))
* gc.collect()
*/
- __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_GIVEREF(__pyx_t_11);
- __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_11;
- __pyx_t_11 = 0;
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_1) {
+ __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __pyx_t_27 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_GIVEREF(__pyx_t_27);
+ __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_27;
+ __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1217
+ /* "cdec/sa/rulefactory.pxi":1217
*
* stop_time = monitor_cpu()
* logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time)) # <<<<<<<<<<<<<<
* gc.collect()
* logger.info(" Extract time = %f seconds", self.extract_time)
*/
- __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_info); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_8 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_11 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Total_time_for_rule_lookup_extra);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_Total_time_for_rule_lookup_extra);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_2, __pyx_kp_s_Total_time_for_rule_lookup_extra);
__Pyx_GIVEREF(__pyx_kp_s_Total_time_for_rule_lookup_extra);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_2, __pyx_t_11);
+ __Pyx_GIVEREF(__pyx_t_11);
+ __pyx_t_11 = 0;
+ __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1218
+ /* "cdec/sa/rulefactory.pxi":1218
* stop_time = monitor_cpu()
* logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time))
* gc.collect() # <<<<<<<<<<<<<<
* logger.info(" Extract time = %f seconds", self.extract_time)
* logger.info(" Intersect time = %f seconds", self.intersect_time)
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_collect); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_collect); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_1)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_1);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
+ }
+ }
+ if (__pyx_t_1) {
+ __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __pyx_t_27 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1219
+ /* "cdec/sa/rulefactory.pxi":1219
* logger.info("Total time for rule lookup, extraction, and scoring = %f seconds", (stop_time - start_time))
* gc.collect()
* logger.info(" Extract time = %f seconds", self.extract_time) # <<<<<<<<<<<<<<
* logger.info(" Intersect time = %f seconds", self.intersect_time)
*
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_info); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_11 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_11)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_11) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Extract_time_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_kp_s_Extract_time_f_seconds);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_2, __pyx_kp_s_Extract_time_f_seconds);
__Pyx_GIVEREF(__pyx_kp_s_Extract_time_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_2, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
+ __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1220
+ /* "cdec/sa/rulefactory.pxi":1220
* gc.collect()
* logger.info(" Extract time = %f seconds", self.extract_time)
* logger.info(" Intersect time = %f seconds", self.intersect_time) # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_info); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_16 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_11 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
+ if (__pyx_t_16) {
+ PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = NULL;
+ }
__Pyx_INCREF(__pyx_kp_s_Intersect_time_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_Intersect_time_f_seconds);
+ PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_2, __pyx_kp_s_Intersect_time_f_seconds);
__Pyx_GIVEREF(__pyx_kp_s_Intersect_time_f_seconds);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_2, __pyx_t_1);
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
+ __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_27)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_27);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":981
+ /* "cdec/sa/rulefactory.pxi":981
* return sorted(result);
*
* def input(self, fwords, meta, ctx_name=None): # <<<<<<<<<<<<<<
@@ -54775,7 +58370,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_14);
@@ -54784,6 +58379,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
__Pyx_XDECREF(__pyx_t_17);
__Pyx_XDECREF(__pyx_t_18);
__Pyx_XDECREF(__pyx_t_19);
+ __Pyx_XDECREF(__pyx_t_27);
__Pyx_AddTraceback("input", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -54793,7 +58389,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1223
+/* "cdec/sa/rulefactory.pxi":1223
*
*
* cdef int find_fixpoint(self, # <<<<<<<<<<<<<<
@@ -54815,15 +58411,14 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
- int __pyx_t_5;
+ PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("find_fixpoint", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1238
+ /* "cdec/sa/rulefactory.pxi":1238
* cdef int e_low_prev, e_high_prev, f_low_prev, f_high_prev, new_x, new_low_x, new_high_x
*
* e_low[0] = e_in_low # <<<<<<<<<<<<<<
@@ -54832,7 +58427,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_e_low[0]) = __pyx_v_e_in_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1239
+ /* "cdec/sa/rulefactory.pxi":1239
*
* e_low[0] = e_in_low
* e_high[0] = e_in_high # <<<<<<<<<<<<<<
@@ -54841,7 +58436,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_e_high[0]) = __pyx_v_e_in_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1240
+ /* "cdec/sa/rulefactory.pxi":1240
* e_low[0] = e_in_low
* e_high[0] = e_in_high
* self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<<
@@ -54853,7 +58448,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1241
+ /* "cdec/sa/rulefactory.pxi":1241
* e_high[0] = e_in_high
* self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high)
* if e_low[0] == -1: # <<<<<<<<<<<<<<
@@ -54863,7 +58458,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_t_3 = (((__pyx_v_e_low[0]) == -1) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1247
+ /* "cdec/sa/rulefactory.pxi":1247
* # rule X -> X_1 w X_2 / X_1 X_2. This is probably
* # not worth the bother, though.
* return 0 # <<<<<<<<<<<<<<
@@ -54874,33 +58469,37 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1248
+ /* "cdec/sa/rulefactory.pxi":1248
* # not worth the bother, though.
* return 0
* elif e_in_low != -1 and e_low[0] != e_in_low: # <<<<<<<<<<<<<<
* if e_in_low - e_low[0] < min_ex_size:
* e_low[0] = e_in_low - min_ex_size
*/
- __pyx_t_3 = ((__pyx_v_e_in_low != -1) != 0);
- if (__pyx_t_3) {
- __pyx_t_4 = (((__pyx_v_e_low[0]) != __pyx_v_e_in_low) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((__pyx_v_e_in_low != -1) != 0);
+ if (__pyx_t_4) {
+ goto __pyx_L5_next_and;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L5_next_and:;
+ __pyx_t_4 = (((__pyx_v_e_low[0]) != __pyx_v_e_in_low) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1249
+ /* "cdec/sa/rulefactory.pxi":1249
* return 0
* elif e_in_low != -1 and e_low[0] != e_in_low:
* if e_in_low - e_low[0] < min_ex_size: # <<<<<<<<<<<<<<
* e_low[0] = e_in_low - min_ex_size
* if e_low[0] < 0:
*/
- __pyx_t_5 = (((__pyx_v_e_in_low - (__pyx_v_e_low[0])) < __pyx_v_min_ex_size) != 0);
- if (__pyx_t_5) {
+ __pyx_t_3 = (((__pyx_v_e_in_low - (__pyx_v_e_low[0])) < __pyx_v_min_ex_size) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1250
+ /* "cdec/sa/rulefactory.pxi":1250
* elif e_in_low != -1 and e_low[0] != e_in_low:
* if e_in_low - e_low[0] < min_ex_size:
* e_low[0] = e_in_low - min_ex_size # <<<<<<<<<<<<<<
@@ -54909,17 +58508,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1251
+ /* "cdec/sa/rulefactory.pxi":1251
* if e_in_low - e_low[0] < min_ex_size:
* e_low[0] = e_in_low - min_ex_size
* if e_low[0] < 0: # <<<<<<<<<<<<<<
* return 0
*
*/
- __pyx_t_5 = (((__pyx_v_e_low[0]) < 0) != 0);
- if (__pyx_t_5) {
+ __pyx_t_3 = (((__pyx_v_e_low[0]) < 0) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1252
+ /* "cdec/sa/rulefactory.pxi":1252
* e_low[0] = e_in_low - min_ex_size
* if e_low[0] < 0:
* return 0 # <<<<<<<<<<<<<<
@@ -54929,24 +58528,24 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_r = 0;
goto __pyx_L0;
}
- goto __pyx_L4;
+ goto __pyx_L6;
}
- __pyx_L4:;
+ __pyx_L6:;
goto __pyx_L3;
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1254
+ /* "cdec/sa/rulefactory.pxi":1254
* return 0
*
* if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<<
* return 0
* elif e_in_high != -1 and e_high[0] != e_in_high:
*/
- __pyx_t_5 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0);
- if (__pyx_t_5) {
+ __pyx_t_3 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1255
+ /* "cdec/sa/rulefactory.pxi":1255
*
* if e_high[0] - e_low[0] > max_e_len:
* return 0 # <<<<<<<<<<<<<<
@@ -54957,33 +58556,37 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1256
+ /* "cdec/sa/rulefactory.pxi":1256
* if e_high[0] - e_low[0] > max_e_len:
* return 0
* elif e_in_high != -1 and e_high[0] != e_in_high: # <<<<<<<<<<<<<<
* if e_high[0] - e_in_high < min_ex_size:
* e_high[0] = e_in_high + min_ex_size
*/
- __pyx_t_5 = ((__pyx_v_e_in_high != -1) != 0);
- if (__pyx_t_5) {
- __pyx_t_3 = (((__pyx_v_e_high[0]) != __pyx_v_e_in_high) != 0);
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_4 = ((__pyx_v_e_in_high != -1) != 0);
+ if (__pyx_t_4) {
+ goto __pyx_L10_next_and;
} else {
- __pyx_t_4 = __pyx_t_5;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L9_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L10_next_and:;
+ __pyx_t_4 = (((__pyx_v_e_high[0]) != __pyx_v_e_in_high) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L9_bool_binop_done:;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1257
+ /* "cdec/sa/rulefactory.pxi":1257
* return 0
* elif e_in_high != -1 and e_high[0] != e_in_high:
* if e_high[0] - e_in_high < min_ex_size: # <<<<<<<<<<<<<<
* e_high[0] = e_in_high + min_ex_size
* if e_high[0] > e_sent_len:
*/
- __pyx_t_4 = ((((__pyx_v_e_high[0]) - __pyx_v_e_in_high) < __pyx_v_min_ex_size) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((((__pyx_v_e_high[0]) - __pyx_v_e_in_high) < __pyx_v_min_ex_size) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1258
+ /* "cdec/sa/rulefactory.pxi":1258
* elif e_in_high != -1 and e_high[0] != e_in_high:
* if e_high[0] - e_in_high < min_ex_size:
* e_high[0] = e_in_high + min_ex_size # <<<<<<<<<<<<<<
@@ -54992,17 +58595,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1259
+ /* "cdec/sa/rulefactory.pxi":1259
* if e_high[0] - e_in_high < min_ex_size:
* e_high[0] = e_in_high + min_ex_size
* if e_high[0] > e_sent_len: # <<<<<<<<<<<<<<
* return 0
*
*/
- __pyx_t_4 = (((__pyx_v_e_high[0]) > __pyx_v_e_sent_len) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_e_high[0]) > __pyx_v_e_sent_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1260
+ /* "cdec/sa/rulefactory.pxi":1260
* e_high[0] = e_in_high + min_ex_size
* if e_high[0] > e_sent_len:
* return 0 # <<<<<<<<<<<<<<
@@ -55012,14 +58615,14 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_r = 0;
goto __pyx_L0;
}
- goto __pyx_L7;
+ goto __pyx_L11;
}
- __pyx_L7:;
- goto __pyx_L6;
+ __pyx_L11:;
+ goto __pyx_L8;
}
- __pyx_L6:;
+ __pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1262
+ /* "cdec/sa/rulefactory.pxi":1262
* return 0
*
* f_back_low[0] = -1 # <<<<<<<<<<<<<<
@@ -55028,7 +58631,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_f_back_low[0]) = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1263
+ /* "cdec/sa/rulefactory.pxi":1263
*
* f_back_low[0] = -1
* f_back_high[0] = -1 # <<<<<<<<<<<<<<
@@ -55037,7 +58640,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_f_back_high[0]) = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1264
+ /* "cdec/sa/rulefactory.pxi":1264
* f_back_low[0] = -1
* f_back_high[0] = -1
* f_low_prev = f_low # <<<<<<<<<<<<<<
@@ -55046,7 +58649,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_f_low_prev = __pyx_v_f_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1265
+ /* "cdec/sa/rulefactory.pxi":1265
* f_back_high[0] = -1
* f_low_prev = f_low
* f_high_prev = f_high # <<<<<<<<<<<<<<
@@ -55056,7 +58659,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_f_high_prev = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1266
+ /* "cdec/sa/rulefactory.pxi":1266
* f_low_prev = f_low
* f_high_prev = f_high
* new_x = 0 # <<<<<<<<<<<<<<
@@ -55065,7 +58668,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_x = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1267
+ /* "cdec/sa/rulefactory.pxi":1267
* f_high_prev = f_high
* new_x = 0
* new_low_x = 0 # <<<<<<<<<<<<<<
@@ -55074,7 +58677,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_low_x = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1268
+ /* "cdec/sa/rulefactory.pxi":1268
* new_x = 0
* new_low_x = 0
* new_high_x = 0 # <<<<<<<<<<<<<<
@@ -55083,7 +58686,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_high_x = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1270
+ /* "cdec/sa/rulefactory.pxi":1270
* new_high_x = 0
*
* while True: # <<<<<<<<<<<<<<
@@ -55092,17 +58695,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
while (1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1272
+ /* "cdec/sa/rulefactory.pxi":1272
* while True:
*
* if f_back_low[0] == -1: # <<<<<<<<<<<<<<
* self.find_projection(e_low[0], e_high[0], e_links_low, e_links_high, f_back_low, f_back_high)
* else:
*/
- __pyx_t_4 = (((__pyx_v_f_back_low[0]) == -1) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_f_back_low[0]) == -1) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1273
+ /* "cdec/sa/rulefactory.pxi":1273
*
* if f_back_low[0] == -1:
* self.find_projection(e_low[0], e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<<
@@ -55112,11 +58715,11 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, (__pyx_v_e_low[0]), (__pyx_v_e_high[0]), __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_f_back_low, __pyx_v_f_back_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L11;
+ goto __pyx_L15;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1275
+ /* "cdec/sa/rulefactory.pxi":1275
* self.find_projection(e_low[0], e_high[0], e_links_low, e_links_high, f_back_low, f_back_high)
* else:
* self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<<
@@ -55127,7 +58730,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1276
+ /* "cdec/sa/rulefactory.pxi":1276
* else:
* self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high)
* self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) # <<<<<<<<<<<<<<
@@ -55138,19 +58741,19 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
- __pyx_L11:;
+ __pyx_L15:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1278
+ /* "cdec/sa/rulefactory.pxi":1278
* self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high)
*
* if f_back_low[0] > f_low: # <<<<<<<<<<<<<<
* f_back_low[0] = f_low
*
*/
- __pyx_t_4 = (((__pyx_v_f_back_low[0]) > __pyx_v_f_low) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_f_back_low[0]) > __pyx_v_f_low) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1279
+ /* "cdec/sa/rulefactory.pxi":1279
*
* if f_back_low[0] > f_low:
* f_back_low[0] = f_low # <<<<<<<<<<<<<<
@@ -55158,11 +58761,11 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
* if f_back_high[0] < f_high:
*/
(__pyx_v_f_back_low[0]) = __pyx_v_f_low;
- goto __pyx_L12;
+ goto __pyx_L16;
}
- __pyx_L12:;
+ __pyx_L16:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1281
+ /* "cdec/sa/rulefactory.pxi":1281
* f_back_low[0] = f_low
*
* if f_back_high[0] < f_high: # <<<<<<<<<<<<<<
@@ -55171,13 +58774,13 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_high, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_high, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (__pyx_t_4) {
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1282
+ /* "cdec/sa/rulefactory.pxi":1282
*
* if f_back_high[0] < f_high:
* f_back_high[0] = f_high # <<<<<<<<<<<<<<
@@ -55186,11 +58789,11 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_f_back_high[0]) = __pyx_t_1;
- goto __pyx_L13;
+ goto __pyx_L17;
}
- __pyx_L13:;
+ __pyx_L17:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1284
+ /* "cdec/sa/rulefactory.pxi":1284
* f_back_high[0] = f_high
*
* if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<<
@@ -55199,14 +58802,18 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_t_4 = (((__pyx_v_f_back_low[0]) == __pyx_v_f_low_prev) != 0);
if (__pyx_t_4) {
- __pyx_t_5 = (((__pyx_v_f_back_high[0]) == __pyx_v_f_high_prev) != 0);
- __pyx_t_3 = __pyx_t_5;
+ goto __pyx_L20_next_and;
} else {
__pyx_t_3 = __pyx_t_4;
+ goto __pyx_L19_bool_binop_done;
}
+ __pyx_L20_next_and:;
+ __pyx_t_4 = (((__pyx_v_f_back_high[0]) == __pyx_v_f_high_prev) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L19_bool_binop_done:;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1285
+ /* "cdec/sa/rulefactory.pxi":1285
*
* if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev:
* return 1 # <<<<<<<<<<<<<<
@@ -55217,23 +58824,27 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1287
+ /* "cdec/sa/rulefactory.pxi":1287
* return 1
*
* if allow_low_x == 0 and f_back_low[0] < f_low: # <<<<<<<<<<<<<<
* # FAIL: f phrase is not tight
* return 0
*/
- __pyx_t_3 = ((__pyx_v_allow_low_x == 0) != 0);
- if (__pyx_t_3) {
- __pyx_t_4 = (((__pyx_v_f_back_low[0]) < __pyx_v_f_low) != 0);
- __pyx_t_5 = __pyx_t_4;
+ __pyx_t_4 = ((__pyx_v_allow_low_x == 0) != 0);
+ if (__pyx_t_4) {
+ goto __pyx_L23_next_and;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L22_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L23_next_and:;
+ __pyx_t_4 = (((__pyx_v_f_back_low[0]) < __pyx_v_f_low) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L22_bool_binop_done:;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1289
+ /* "cdec/sa/rulefactory.pxi":1289
* if allow_low_x == 0 and f_back_low[0] < f_low:
* # FAIL: f phrase is not tight
* return 0 # <<<<<<<<<<<<<<
@@ -55244,17 +58855,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1291
+ /* "cdec/sa/rulefactory.pxi":1291
* return 0
*
* if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<<
* # FAIL: f back projection is too wide
* return 0
*/
- __pyx_t_5 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
- if (__pyx_t_5) {
+ __pyx_t_3 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1293
+ /* "cdec/sa/rulefactory.pxi":1293
* if f_back_high[0] - f_back_low[0] > max_f_len:
* # FAIL: f back projection is too wide
* return 0 # <<<<<<<<<<<<<<
@@ -55265,28 +58876,32 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1295
+ /* "cdec/sa/rulefactory.pxi":1295
* return 0
*
* if allow_high_x == 0 and f_back_high[0] > f_high: # <<<<<<<<<<<<<<
* # FAIL: extension on high side not allowed
* return 0
*/
- __pyx_t_5 = (__pyx_v_allow_high_x == 0);
- if (__pyx_t_5) {
- __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_v_f_high, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_4 = ((__pyx_v_allow_high_x == 0) != 0);
+ if (__pyx_t_4) {
+ goto __pyx_L27_next_and;
} else {
- __pyx_t_4 = __pyx_t_5;
+ __pyx_t_3 = __pyx_t_4;
+ goto __pyx_L26_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L27_next_and:;
+ __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_v_f_high, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L26_bool_binop_done:;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1297
+ /* "cdec/sa/rulefactory.pxi":1297
* if allow_high_x == 0 and f_back_high[0] > f_high:
* # FAIL: extension on high side not allowed
* return 0 # <<<<<<<<<<<<<<
@@ -55297,37 +58912,37 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1299
+ /* "cdec/sa/rulefactory.pxi":1299
* return 0
*
* if f_low != f_back_low[0]: # <<<<<<<<<<<<<<
* if new_low_x == 0:
* if new_x >= max_new_x:
*/
- __pyx_t_4 = ((__pyx_v_f_low != (__pyx_v_f_back_low[0])) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_f_low != (__pyx_v_f_back_low[0])) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1300
+ /* "cdec/sa/rulefactory.pxi":1300
*
* if f_low != f_back_low[0]:
* if new_low_x == 0: # <<<<<<<<<<<<<<
* if new_x >= max_new_x:
* # FAIL: extension required on low side violates max # of gaps
*/
- __pyx_t_4 = ((__pyx_v_new_low_x == 0) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_new_low_x == 0) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1301
+ /* "cdec/sa/rulefactory.pxi":1301
* if f_low != f_back_low[0]:
* if new_low_x == 0:
* if new_x >= max_new_x: # <<<<<<<<<<<<<<
* # FAIL: extension required on low side violates max # of gaps
* return 0
*/
- __pyx_t_4 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1303
+ /* "cdec/sa/rulefactory.pxi":1303
* if new_x >= max_new_x:
* # FAIL: extension required on low side violates max # of gaps
* return 0 # <<<<<<<<<<<<<<
@@ -55339,7 +58954,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1305
+ /* "cdec/sa/rulefactory.pxi":1305
* return 0
* else:
* new_x = new_x + 1 # <<<<<<<<<<<<<<
@@ -55348,7 +58963,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_x = (__pyx_v_new_x + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1306
+ /* "cdec/sa/rulefactory.pxi":1306
* else:
* new_x = new_x + 1
* new_low_x = 1 # <<<<<<<<<<<<<<
@@ -55357,21 +58972,21 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_low_x = 1;
}
- goto __pyx_L19;
+ goto __pyx_L29;
}
- __pyx_L19:;
+ __pyx_L29:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1307
+ /* "cdec/sa/rulefactory.pxi":1307
* new_x = new_x + 1
* new_low_x = 1
* if f_low - f_back_low[0] < min_fx_size: # <<<<<<<<<<<<<<
* f_back_low[0] = f_low - min_fx_size
* if f_back_high[0] - f_back_low[0] > max_f_len:
*/
- __pyx_t_4 = (((__pyx_v_f_low - (__pyx_v_f_back_low[0])) < __pyx_v_min_fx_size) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_f_low - (__pyx_v_f_back_low[0])) < __pyx_v_min_fx_size) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1308
+ /* "cdec/sa/rulefactory.pxi":1308
* new_low_x = 1
* if f_low - f_back_low[0] < min_fx_size:
* f_back_low[0] = f_low - min_fx_size # <<<<<<<<<<<<<<
@@ -55380,17 +58995,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
(__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1309
+ /* "cdec/sa/rulefactory.pxi":1309
* if f_low - f_back_low[0] < min_fx_size:
* f_back_low[0] = f_low - min_fx_size
* if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<<
* # FAIL: extension required on low side violates max initial length
* return 0
*/
- __pyx_t_4 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1311
+ /* "cdec/sa/rulefactory.pxi":1311
* if f_back_high[0] - f_back_low[0] > max_f_len:
* # FAIL: extension required on low side violates max initial length
* return 0 # <<<<<<<<<<<<<<
@@ -55401,17 +59016,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1312
+ /* "cdec/sa/rulefactory.pxi":1312
* # FAIL: extension required on low side violates max initial length
* return 0
* if f_back_low[0] < 0: # <<<<<<<<<<<<<<
* # FAIL: extension required on low side violates sentence boundary
* return 0
*/
- __pyx_t_4 = (((__pyx_v_f_back_low[0]) < 0) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_f_back_low[0]) < 0) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1314
+ /* "cdec/sa/rulefactory.pxi":1314
* if f_back_low[0] < 0:
* # FAIL: extension required on low side violates sentence boundary
* return 0 # <<<<<<<<<<<<<<
@@ -55421,14 +59036,14 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_r = 0;
goto __pyx_L0;
}
- goto __pyx_L21;
+ goto __pyx_L31;
}
- __pyx_L21:;
- goto __pyx_L18;
+ __pyx_L31:;
+ goto __pyx_L28;
}
- __pyx_L18:;
+ __pyx_L28:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1316
+ /* "cdec/sa/rulefactory.pxi":1316
* return 0
*
* if f_high != f_back_high[0]: # <<<<<<<<<<<<<<
@@ -55437,33 +59052,33 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyObject_RichCompare(__pyx_v_f_high, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_RichCompare(__pyx_v_f_high, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (__pyx_t_4) {
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1317
+ /* "cdec/sa/rulefactory.pxi":1317
*
* if f_high != f_back_high[0]:
* if new_high_x == 0: # <<<<<<<<<<<<<<
* if new_x >= max_new_x:
* # FAIL: extension required on high side violates max # of gaps
*/
- __pyx_t_4 = ((__pyx_v_new_high_x == 0) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_new_high_x == 0) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1318
+ /* "cdec/sa/rulefactory.pxi":1318
* if f_high != f_back_high[0]:
* if new_high_x == 0:
* if new_x >= max_new_x: # <<<<<<<<<<<<<<
* # FAIL: extension required on high side violates max # of gaps
* return 0
*/
- __pyx_t_4 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1320
+ /* "cdec/sa/rulefactory.pxi":1320
* if new_x >= max_new_x:
* # FAIL: extension required on high side violates max # of gaps
* return 0 # <<<<<<<<<<<<<<
@@ -55475,7 +59090,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1322
+ /* "cdec/sa/rulefactory.pxi":1322
* return 0
* else:
* new_x = new_x + 1 # <<<<<<<<<<<<<<
@@ -55484,7 +59099,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_x = (__pyx_v_new_x + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1323
+ /* "cdec/sa/rulefactory.pxi":1323
* else:
* new_x = new_x + 1
* new_high_x = 1 # <<<<<<<<<<<<<<
@@ -55493,58 +59108,58 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_new_high_x = 1;
}
- goto __pyx_L25;
+ goto __pyx_L35;
}
- __pyx_L25:;
+ __pyx_L35:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1324
+ /* "cdec/sa/rulefactory.pxi":1324
* new_x = new_x + 1
* new_high_x = 1
* if f_back_high[0] - f_high < min_fx_size: # <<<<<<<<<<<<<<
* f_back_high[0] = f_high + min_fx_size
* if f_back_high[0] - f_back_low[0] > max_f_len:
*/
- __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_f_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_f_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- if (__pyx_t_4) {
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1325
+ /* "cdec/sa/rulefactory.pxi":1325
* new_high_x = 1
* if f_back_high[0] - f_high < min_fx_size:
* f_back_high[0] = f_high + min_fx_size # <<<<<<<<<<<<<<
* if f_back_high[0] - f_back_low[0] > max_f_len:
* # FAIL: extension required on high side violates max initial length
*/
- __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyNumber_Add(__pyx_v_f_high, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Add(__pyx_v_f_high, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
(__pyx_v_f_back_high[0]) = __pyx_t_1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1326
+ /* "cdec/sa/rulefactory.pxi":1326
* if f_back_high[0] - f_high < min_fx_size:
* f_back_high[0] = f_high + min_fx_size
* if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<<
* # FAIL: extension required on high side violates max initial length
* return 0
*/
- __pyx_t_4 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = ((((__pyx_v_f_back_high[0]) - (__pyx_v_f_back_low[0])) > __pyx_v_max_f_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1328
+ /* "cdec/sa/rulefactory.pxi":1328
* if f_back_high[0] - f_back_low[0] > max_f_len:
* # FAIL: extension required on high side violates max initial length
* return 0 # <<<<<<<<<<<<<<
@@ -55555,17 +59170,17 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1329
+ /* "cdec/sa/rulefactory.pxi":1329
* # FAIL: extension required on high side violates max initial length
* return 0
* if f_back_high[0] > f_sent_len: # <<<<<<<<<<<<<<
* # FAIL: extension required on high side violates sentence boundary
* return 0
*/
- __pyx_t_4 = (((__pyx_v_f_back_high[0]) > __pyx_v_f_sent_len) != 0);
- if (__pyx_t_4) {
+ __pyx_t_3 = (((__pyx_v_f_back_high[0]) > __pyx_v_f_sent_len) != 0);
+ if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1331
+ /* "cdec/sa/rulefactory.pxi":1331
* if f_back_high[0] > f_sent_len:
* # FAIL: extension required on high side violates sentence boundary
* return 0 # <<<<<<<<<<<<<<
@@ -55575,14 +59190,14 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_r = 0;
goto __pyx_L0;
}
- goto __pyx_L27;
+ goto __pyx_L37;
}
- __pyx_L27:;
- goto __pyx_L24;
+ __pyx_L37:;
+ goto __pyx_L34;
}
- __pyx_L24:;
+ __pyx_L34:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1333
+ /* "cdec/sa/rulefactory.pxi":1333
* return 0
*
* e_low_prev = e_low[0] # <<<<<<<<<<<<<<
@@ -55591,7 +59206,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_e_low_prev = (__pyx_v_e_low[0]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1334
+ /* "cdec/sa/rulefactory.pxi":1334
*
* e_low_prev = e_low[0]
* e_high_prev = e_high[0] # <<<<<<<<<<<<<<
@@ -55600,29 +59215,29 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_e_high_prev = (__pyx_v_e_high[0]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1336
+ /* "cdec/sa/rulefactory.pxi":1336
* e_high_prev = e_high[0]
*
* self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<<
* self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high)
* if e_low[0] == e_low_prev and e_high[0] == e_high_prev:
*/
- __pyx_t_6 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, (__pyx_v_f_back_low[0]), __pyx_v_f_low_prev, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_5 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, (__pyx_v_f_back_low[0]), __pyx_v_f_low_prev, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1337
+ /* "cdec/sa/rulefactory.pxi":1337
*
* self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high)
* self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high) # <<<<<<<<<<<<<<
* if e_low[0] == e_low_prev and e_high[0] == e_high_prev:
* return 1
*/
- __pyx_t_6 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_high_prev, (__pyx_v_f_back_high[0]), __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_5 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_high_prev, (__pyx_v_f_back_high[0]), __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1338
+ /* "cdec/sa/rulefactory.pxi":1338
* self.find_projection(f_back_low[0], f_low_prev, f_links_low, f_links_high, e_low, e_high)
* self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high)
* if e_low[0] == e_low_prev and e_high[0] == e_high_prev: # <<<<<<<<<<<<<<
@@ -55631,14 +59246,18 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_t_4 = (((__pyx_v_e_low[0]) == __pyx_v_e_low_prev) != 0);
if (__pyx_t_4) {
- __pyx_t_5 = (((__pyx_v_e_high[0]) == __pyx_v_e_high_prev) != 0);
- __pyx_t_3 = __pyx_t_5;
+ goto __pyx_L42_next_and;
} else {
__pyx_t_3 = __pyx_t_4;
+ goto __pyx_L41_bool_binop_done;
}
+ __pyx_L42_next_and:;
+ __pyx_t_4 = (((__pyx_v_e_high[0]) == __pyx_v_e_high_prev) != 0);
+ __pyx_t_3 = __pyx_t_4;
+ __pyx_L41_bool_binop_done:;
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1339
+ /* "cdec/sa/rulefactory.pxi":1339
* self.find_projection(f_high_prev, f_back_high[0], f_links_low, f_links_high, e_low, e_high)
* if e_low[0] == e_low_prev and e_high[0] == e_high_prev:
* return 1 # <<<<<<<<<<<<<<
@@ -55649,7 +59268,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1340
+ /* "cdec/sa/rulefactory.pxi":1340
* if e_low[0] == e_low_prev and e_high[0] == e_high_prev:
* return 1
* if allow_arbitrary_x == 0: # <<<<<<<<<<<<<<
@@ -55659,7 +59278,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_t_3 = ((__pyx_v_allow_arbitrary_x == 0) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1342
+ /* "cdec/sa/rulefactory.pxi":1342
* if allow_arbitrary_x == 0:
* # FAIL: arbitrary expansion not permitted
* return 0 # <<<<<<<<<<<<<<
@@ -55670,7 +59289,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1343
+ /* "cdec/sa/rulefactory.pxi":1343
* # FAIL: arbitrary expansion not permitted
* return 0
* if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<<
@@ -55680,7 +59299,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_t_3 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0);
if (__pyx_t_3) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1345
+ /* "cdec/sa/rulefactory.pxi":1345
* if e_high[0] - e_low[0] > max_e_len:
* # FAIL: re-projection violates sentence max phrase length
* return 0 # <<<<<<<<<<<<<<
@@ -55691,7 +59310,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1346
+ /* "cdec/sa/rulefactory.pxi":1346
* # FAIL: re-projection violates sentence max phrase length
* return 0
* f_low_prev = f_back_low[0] # <<<<<<<<<<<<<<
@@ -55700,7 +59319,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
*/
__pyx_v_f_low_prev = (__pyx_v_f_back_low[0]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1347
+ /* "cdec/sa/rulefactory.pxi":1347
* return 0
* f_low_prev = f_back_low[0]
* f_high_prev = f_back_high[0] # <<<<<<<<<<<<<<
@@ -55710,7 +59329,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
__pyx_v_f_high_prev = (__pyx_v_f_back_high[0]);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1223
+ /* "cdec/sa/rulefactory.pxi":1223
*
*
* cdef int find_fixpoint(self, # <<<<<<<<<<<<<<
@@ -55723,8 +59342,8 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
__Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
__pyx_r = 0;
__pyx_L0:;
@@ -55732,7 +59351,7 @@ static int __pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1350
+/* "cdec/sa/rulefactory.pxi":1350
*
*
* cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<<
@@ -55747,10 +59366,9 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
- int __pyx_t_4;
__Pyx_RefNannySetupContext("find_projection", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1353
+ /* "cdec/sa/rulefactory.pxi":1353
* int* out_low, int* out_high):
* cdef int i
* for i from in_low <= i < in_high: # <<<<<<<<<<<<<<
@@ -55760,7 +59378,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
__pyx_t_1 = __pyx_v_in_high;
for (__pyx_v_i = __pyx_v_in_low; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1354
+ /* "cdec/sa/rulefactory.pxi":1354
* cdef int i
* for i from in_low <= i < in_high:
* if in_links_low[i] != -1: # <<<<<<<<<<<<<<
@@ -55770,23 +59388,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
__pyx_t_2 = (((__pyx_v_in_links_low[__pyx_v_i]) != -1) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1355
+ /* "cdec/sa/rulefactory.pxi":1355
* for i from in_low <= i < in_high:
* if in_links_low[i] != -1:
* if out_low[0] == -1 or in_links_low[i] < out_low[0]: # <<<<<<<<<<<<<<
* out_low[0] = in_links_low[i]
* if out_high[0] == -1 or in_links_high[i] > out_high[0]:
*/
- __pyx_t_2 = (((__pyx_v_out_low[0]) == -1) != 0);
- if (!__pyx_t_2) {
- __pyx_t_3 = (((__pyx_v_in_links_low[__pyx_v_i]) < (__pyx_v_out_low[0])) != 0);
- __pyx_t_4 = __pyx_t_3;
+ __pyx_t_3 = (((__pyx_v_out_low[0]) == -1) != 0);
+ if (!__pyx_t_3) {
+ goto __pyx_L8_next_or;
} else {
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L7_bool_binop_done;
}
- if (__pyx_t_4) {
+ __pyx_L8_next_or:;
+ __pyx_t_3 = (((__pyx_v_in_links_low[__pyx_v_i]) < (__pyx_v_out_low[0])) != 0);
+ __pyx_t_2 = __pyx_t_3;
+ __pyx_L7_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1356
+ /* "cdec/sa/rulefactory.pxi":1356
* if in_links_low[i] != -1:
* if out_low[0] == -1 or in_links_low[i] < out_low[0]:
* out_low[0] = in_links_low[i] # <<<<<<<<<<<<<<
@@ -55798,23 +59420,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
}
__pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1357
+ /* "cdec/sa/rulefactory.pxi":1357
* if out_low[0] == -1 or in_links_low[i] < out_low[0]:
* out_low[0] = in_links_low[i]
* if out_high[0] == -1 or in_links_high[i] > out_high[0]: # <<<<<<<<<<<<<<
* out_high[0] = in_links_high[i]
*
*/
- __pyx_t_4 = (((__pyx_v_out_high[0]) == -1) != 0);
- if (!__pyx_t_4) {
- __pyx_t_2 = (((__pyx_v_in_links_high[__pyx_v_i]) > (__pyx_v_out_high[0])) != 0);
- __pyx_t_3 = __pyx_t_2;
+ __pyx_t_3 = (((__pyx_v_out_high[0]) == -1) != 0);
+ if (!__pyx_t_3) {
+ goto __pyx_L11_next_or;
} else {
- __pyx_t_3 = __pyx_t_4;
+ __pyx_t_2 = __pyx_t_3;
+ goto __pyx_L10_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L11_next_or:;
+ __pyx_t_3 = (((__pyx_v_in_links_high[__pyx_v_i]) > (__pyx_v_out_high[0])) != 0);
+ __pyx_t_2 = __pyx_t_3;
+ __pyx_L10_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1358
+ /* "cdec/sa/rulefactory.pxi":1358
* out_low[0] = in_links_low[i]
* if out_high[0] == -1 or in_links_high[i] > out_high[0]:
* out_high[0] = in_links_high[i] # <<<<<<<<<<<<<<
@@ -55822,15 +59448,15 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
*
*/
(__pyx_v_out_high[0]) = (__pyx_v_in_links_high[__pyx_v_i]);
- goto __pyx_L7;
+ goto __pyx_L9;
}
- __pyx_L7:;
+ __pyx_L9:;
goto __pyx_L5;
}
__pyx_L5:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1350
+ /* "cdec/sa/rulefactory.pxi":1350
*
*
* cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<<
@@ -55845,7 +59471,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projectio
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1361
+/* "cdec/sa/rulefactory.pxi":1361
*
*
* cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): # <<<<<<<<<<<<<<
@@ -55859,7 +59485,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("int_arr_extend", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1363
+ /* "cdec/sa/rulefactory.pxi":1363
* cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len):
* cdef int new_len
* new_len = arr_len[0] + data_len # <<<<<<<<<<<<<<
@@ -55868,7 +59494,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
*/
__pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1364
+ /* "cdec/sa/rulefactory.pxi":1364
* cdef int new_len
* new_len = arr_len[0] + data_len
* arr = <int*> realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -55877,7 +59503,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
*/
__pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1365
+ /* "cdec/sa/rulefactory.pxi":1365
* new_len = arr_len[0] + data_len
* arr = <int*> realloc(arr, new_len*sizeof(int))
* memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -55886,7 +59512,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
*/
memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_data, (__pyx_v_data_len * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1366
+ /* "cdec/sa/rulefactory.pxi":1366
* arr = <int*> realloc(arr, new_len*sizeof(int))
* memcpy(arr+arr_len[0], data, data_len*sizeof(int))
* arr_len[0] = new_len # <<<<<<<<<<<<<<
@@ -55895,7 +59521,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
*/
(__pyx_v_arr_len[0]) = __pyx_v_new_len;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1367
+ /* "cdec/sa/rulefactory.pxi":1367
* memcpy(arr+arr_len[0], data, data_len*sizeof(int))
* arr_len[0] = new_len
* return arr # <<<<<<<<<<<<<<
@@ -55905,7 +59531,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
__pyx_r = __pyx_v_arr;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1361
+ /* "cdec/sa/rulefactory.pxi":1361
*
*
* cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): # <<<<<<<<<<<<<<
@@ -55919,7 +59545,7 @@ static int *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTH
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1370
+/* "cdec/sa/rulefactory.pxi":1370
*
*
* cdef extract_phrases(self, int e_low, int e_high, int* e_gap_low, int* e_gap_high, int* e_links_low, int num_gaps, # <<<<<<<<<<<<<<
@@ -55955,29 +59581,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
int __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
- int __pyx_t_7;
+ long __pyx_t_7;
int __pyx_t_8;
- long __pyx_t_9;
- int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("extract_phrases", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1378
+ /* "cdec/sa/rulefactory.pxi":1382
* cdef result
*
* result = [] # <<<<<<<<<<<<<<
* len1 = 0
* e_gaps1 = <int*> malloc(0)
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1379
+ /* "cdec/sa/rulefactory.pxi":1383
*
* result = []
* len1 = 0 # <<<<<<<<<<<<<<
@@ -55986,7 +59610,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_len1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1380
+ /* "cdec/sa/rulefactory.pxi":1384
* result = []
* len1 = 0
* e_gaps1 = <int*> malloc(0) # <<<<<<<<<<<<<<
@@ -55995,19 +59619,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps1 = ((int *)malloc(0));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1381
+ /* "cdec/sa/rulefactory.pxi":1385
* len1 = 0
* e_gaps1 = <int*> malloc(0)
* ephr_arr = IntList() # <<<<<<<<<<<<<<
*
* e_gap_order = <int*> malloc(num_gaps*sizeof(int))
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_ephr_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1383
+ /* "cdec/sa/rulefactory.pxi":1387
* ephr_arr = IntList()
*
* e_gap_order = <int*> malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<<
@@ -56016,7 +59640,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1384
+ /* "cdec/sa/rulefactory.pxi":1388
*
* e_gap_order = <int*> malloc(num_gaps*sizeof(int))
* if num_gaps > 0: # <<<<<<<<<<<<<<
@@ -56026,7 +59650,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = ((__pyx_v_num_gaps > 0) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1385
+ /* "cdec/sa/rulefactory.pxi":1389
* e_gap_order = <int*> malloc(num_gaps*sizeof(int))
* if num_gaps > 0:
* e_gap_order[0] = 0 # <<<<<<<<<<<<<<
@@ -56035,7 +59659,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
(__pyx_v_e_gap_order[0]) = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1386
+ /* "cdec/sa/rulefactory.pxi":1390
* if num_gaps > 0:
* e_gap_order[0] = 0
* for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<<
@@ -56045,7 +59669,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_3 = __pyx_v_num_gaps;
for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1387
+ /* "cdec/sa/rulefactory.pxi":1391
* e_gap_order[0] = 0
* for i from 1 <= i < num_gaps:
* for j from 0 <= j < i: # <<<<<<<<<<<<<<
@@ -56055,7 +59679,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_4 = __pyx_v_i;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1388
+ /* "cdec/sa/rulefactory.pxi":1392
* for i from 1 <= i < num_gaps:
* for j from 0 <= j < i:
* if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<<
@@ -56065,7 +59689,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = (((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1389
+ /* "cdec/sa/rulefactory.pxi":1393
* for j from 0 <= j < i:
* if e_gap_low[i] < e_gap_low[j]:
* for k from j <= k < i: # <<<<<<<<<<<<<<
@@ -56075,7 +59699,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_5 = __pyx_v_i;
for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_t_5; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1390
+ /* "cdec/sa/rulefactory.pxi":1394
* if e_gap_low[i] < e_gap_low[j]:
* for k from j <= k < i:
* e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<<
@@ -56085,7 +59709,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
(__pyx_v_e_gap_order[(__pyx_v_k + 1)]) = (__pyx_v_e_gap_order[__pyx_v_k]);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1391
+ /* "cdec/sa/rulefactory.pxi":1395
* for k from j <= k < i:
* e_gap_order[k+1] = e_gap_order[k]
* e_gap_order[j] = i # <<<<<<<<<<<<<<
@@ -56094,7 +59718,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
(__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1392
+ /* "cdec/sa/rulefactory.pxi":1396
* e_gap_order[k+1] = e_gap_order[k]
* e_gap_order[j] = i
* break # <<<<<<<<<<<<<<
@@ -56106,7 +59730,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1394
+ /* "cdec/sa/rulefactory.pxi":1398
* break
* else:
* e_gap_order[i] = i # <<<<<<<<<<<<<<
@@ -56121,7 +59745,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
}
__pyx_L3:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1396
+ /* "cdec/sa/rulefactory.pxi":1400
* e_gap_order[i] = i
*
* e_x_low = e_low # <<<<<<<<<<<<<<
@@ -56130,7 +59754,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_x_low = __pyx_v_e_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1397
+ /* "cdec/sa/rulefactory.pxi":1401
*
* e_x_low = e_low
* e_x_high = e_high # <<<<<<<<<<<<<<
@@ -56139,7 +59763,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_x_high = __pyx_v_e_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1398
+ /* "cdec/sa/rulefactory.pxi":1402
* e_x_low = e_low
* e_x_high = e_high
* if not self.tight_phrases: # <<<<<<<<<<<<<<
@@ -56149,7 +59773,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1399
+ /* "cdec/sa/rulefactory.pxi":1403
* e_x_high = e_high
* if not self.tight_phrases:
* while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1: # <<<<<<<<<<<<<<
@@ -56157,22 +59781,28 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* while e_x_high < e_sent_len and e_x_high - e_low < self.train_max_initial_size and e_links_low[e_x_high] == -1:
*/
while (1) {
- __pyx_t_2 = ((__pyx_v_e_x_low > 0) != 0);
- if (__pyx_t_2) {
- __pyx_t_6 = (((__pyx_v_e_high - __pyx_v_e_x_low) < __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_6) {
- __pyx_t_7 = (((__pyx_v_e_links_low[(__pyx_v_e_x_low - 1)]) == -1) != 0);
- __pyx_t_8 = __pyx_t_7;
- } else {
- __pyx_t_8 = __pyx_t_6;
- }
- __pyx_t_6 = __pyx_t_8;
+ __pyx_t_6 = ((__pyx_v_e_x_low > 0) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L15_next_and;
} else {
- __pyx_t_6 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L14_bool_binop_done;
}
- if (!__pyx_t_6) break;
+ __pyx_L15_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_high - __pyx_v_e_x_low) < __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L16_next_and;
+ } else {
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L14_bool_binop_done;
+ }
+ __pyx_L16_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_links_low[(__pyx_v_e_x_low - 1)]) == -1) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L14_bool_binop_done:;
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1400
+ /* "cdec/sa/rulefactory.pxi":1404
* if not self.tight_phrases:
* while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1:
* e_x_low = e_x_low - 1 # <<<<<<<<<<<<<<
@@ -56182,7 +59812,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_v_e_x_low = (__pyx_v_e_x_low - 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1401
+ /* "cdec/sa/rulefactory.pxi":1405
* while e_x_low > 0 and e_high - e_x_low < self.train_max_initial_size and e_links_low[e_x_low-1] == -1:
* e_x_low = e_x_low - 1
* while e_x_high < e_sent_len and e_x_high - e_low < self.train_max_initial_size and e_links_low[e_x_high] == -1: # <<<<<<<<<<<<<<
@@ -56192,20 +59822,26 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
while (1) {
__pyx_t_6 = ((__pyx_v_e_x_high < __pyx_v_e_sent_len) != 0);
if (__pyx_t_6) {
- __pyx_t_2 = (((__pyx_v_e_x_high - __pyx_v_e_low) < __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_2) {
- __pyx_t_8 = (((__pyx_v_e_links_low[__pyx_v_e_x_high]) == -1) != 0);
- __pyx_t_7 = __pyx_t_8;
- } else {
- __pyx_t_7 = __pyx_t_2;
- }
- __pyx_t_2 = __pyx_t_7;
+ goto __pyx_L20_next_and;
} else {
__pyx_t_2 = __pyx_t_6;
+ goto __pyx_L19_bool_binop_done;
}
+ __pyx_L20_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_x_high - __pyx_v_e_low) < __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L21_next_and;
+ } else {
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L19_bool_binop_done;
+ }
+ __pyx_L21_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_links_low[__pyx_v_e_x_high]) == -1) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L19_bool_binop_done:;
if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1402
+ /* "cdec/sa/rulefactory.pxi":1406
* e_x_low = e_x_low - 1
* while e_x_high < e_sent_len and e_x_high - e_low < self.train_max_initial_size and e_links_low[e_x_high] == -1:
* e_x_high = e_x_high + 1 # <<<<<<<<<<<<<<
@@ -56218,7 +59854,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
}
__pyx_L11:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1404
+ /* "cdec/sa/rulefactory.pxi":1408
* e_x_high = e_x_high + 1
*
* for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<<
@@ -56228,7 +59864,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_3 = __pyx_v_e_low;
for (__pyx_v_i = __pyx_v_e_x_low; __pyx_v_i <= __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1405
+ /* "cdec/sa/rulefactory.pxi":1409
*
* for i from e_x_low <= i <= e_low:
* e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) # <<<<<<<<<<<<<<
@@ -56238,7 +59874,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_v_e_gaps1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps1, (&__pyx_v_len1), (&__pyx_v_i), 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1407
+ /* "cdec/sa/rulefactory.pxi":1411
* e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1)
*
* for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<<
@@ -56248,7 +59884,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_3 = __pyx_v_num_gaps;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1408
+ /* "cdec/sa/rulefactory.pxi":1412
*
* for i from 0 <= i < num_gaps:
* e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<<
@@ -56257,7 +59893,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps2 = ((int *)malloc(0));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1409
+ /* "cdec/sa/rulefactory.pxi":1413
* for i from 0 <= i < num_gaps:
* e_gaps2 = <int*> malloc(0)
* len2 = 0 # <<<<<<<<<<<<<<
@@ -56266,7 +59902,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_len2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1411
+ /* "cdec/sa/rulefactory.pxi":1415
* len2 = 0
*
* j = e_gap_order[i] # <<<<<<<<<<<<<<
@@ -56275,7 +59911,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1412
+ /* "cdec/sa/rulefactory.pxi":1416
*
* j = e_gap_order[i]
* e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<<
@@ -56284,7 +59920,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1413
+ /* "cdec/sa/rulefactory.pxi":1417
* j = e_gap_order[i]
* e_x_gap_low = e_gap_low[j]
* e_x_gap_high = e_gap_high[j] # <<<<<<<<<<<<<<
@@ -56293,7 +59929,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1414
+ /* "cdec/sa/rulefactory.pxi":1418
* e_x_gap_low = e_gap_low[j]
* e_x_gap_high = e_gap_high[j]
* if not self.tight_phrases: # <<<<<<<<<<<<<<
@@ -56303,7 +59939,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1415
+ /* "cdec/sa/rulefactory.pxi":1419
* e_x_gap_high = e_gap_high[j]
* if not self.tight_phrases:
* while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1: # <<<<<<<<<<<<<<
@@ -56311,16 +59947,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* while e_x_gap_high < e_x_high and e_links_low[e_x_gap_high] == -1:
*/
while (1) {
- __pyx_t_2 = ((__pyx_v_e_x_gap_low > __pyx_v_e_x_low) != 0);
- if (__pyx_t_2) {
- __pyx_t_6 = (((__pyx_v_e_links_low[(__pyx_v_e_x_gap_low - 1)]) == -1) != 0);
- __pyx_t_7 = __pyx_t_6;
+ __pyx_t_6 = ((__pyx_v_e_x_gap_low > __pyx_v_e_x_low) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L30_next_and;
} else {
- __pyx_t_7 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L29_bool_binop_done;
}
- if (!__pyx_t_7) break;
+ __pyx_L30_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_links_low[(__pyx_v_e_x_gap_low - 1)]) == -1) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L29_bool_binop_done:;
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1416
+ /* "cdec/sa/rulefactory.pxi":1420
* if not self.tight_phrases:
* while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1:
* e_x_gap_low = e_x_gap_low - 1 # <<<<<<<<<<<<<<
@@ -56330,7 +59970,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1417
+ /* "cdec/sa/rulefactory.pxi":1421
* while e_x_gap_low > e_x_low and e_links_low[e_x_gap_low-1] == -1:
* e_x_gap_low = e_x_gap_low - 1
* while e_x_gap_high < e_x_high and e_links_low[e_x_gap_high] == -1: # <<<<<<<<<<<<<<
@@ -56338,16 +59978,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*
*/
while (1) {
- __pyx_t_7 = ((__pyx_v_e_x_gap_high < __pyx_v_e_x_high) != 0);
- if (__pyx_t_7) {
- __pyx_t_2 = (((__pyx_v_e_links_low[__pyx_v_e_x_gap_high]) == -1) != 0);
- __pyx_t_6 = __pyx_t_2;
+ __pyx_t_6 = ((__pyx_v_e_x_gap_high < __pyx_v_e_x_high) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L34_next_and;
} else {
- __pyx_t_6 = __pyx_t_7;
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L33_bool_binop_done;
}
- if (!__pyx_t_6) break;
+ __pyx_L34_next_and:;
+ __pyx_t_6 = (((__pyx_v_e_links_low[__pyx_v_e_x_gap_high]) == -1) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L33_bool_binop_done:;
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1418
+ /* "cdec/sa/rulefactory.pxi":1422
* e_x_gap_low = e_x_gap_low - 1
* while e_x_gap_high < e_x_high and e_links_low[e_x_gap_high] == -1:
* e_x_gap_high = e_x_gap_high + 1 # <<<<<<<<<<<<<<
@@ -56356,11 +60000,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_x_gap_high = (__pyx_v_e_x_gap_high + 1);
}
- goto __pyx_L20;
+ goto __pyx_L26;
}
- __pyx_L20:;
+ __pyx_L26:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1420
+ /* "cdec/sa/rulefactory.pxi":1424
* e_x_gap_high = e_x_gap_high + 1
*
* k = 0 # <<<<<<<<<<<<<<
@@ -56369,7 +60013,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_k = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1421
+ /* "cdec/sa/rulefactory.pxi":1425
*
* k = 0
* step = 1+(i*2) # <<<<<<<<<<<<<<
@@ -56378,7 +60022,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_step = (1 + (__pyx_v_i * 2));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1422
+ /* "cdec/sa/rulefactory.pxi":1426
* k = 0
* step = 1+(i*2)
* while k < len1: # <<<<<<<<<<<<<<
@@ -56386,10 +60030,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* if m >= e_gaps1[k+step-1]:
*/
while (1) {
- __pyx_t_6 = ((__pyx_v_k < __pyx_v_len1) != 0);
- if (!__pyx_t_6) break;
+ __pyx_t_2 = ((__pyx_v_k < __pyx_v_len1) != 0);
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1423
+ /* "cdec/sa/rulefactory.pxi":1427
* step = 1+(i*2)
* while k < len1:
* for m from e_x_gap_low <= m <= e_gap_low[j]: # <<<<<<<<<<<<<<
@@ -56399,17 +60043,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_4 = (__pyx_v_e_gap_low[__pyx_v_j]);
for (__pyx_v_m = __pyx_v_e_x_gap_low; __pyx_v_m <= __pyx_t_4; __pyx_v_m++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1424
+ /* "cdec/sa/rulefactory.pxi":1428
* while k < len1:
* for m from e_x_gap_low <= m <= e_gap_low[j]:
* if m >= e_gaps1[k+step-1]: # <<<<<<<<<<<<<<
* for n from e_gap_high[j] <= n <= e_x_gap_high:
* if n-m >= 1: # extractor.py doesn't restrict target-side gap length
*/
- __pyx_t_6 = ((__pyx_v_m >= (__pyx_v_e_gaps1[((__pyx_v_k + __pyx_v_step) - 1)])) != 0);
- if (__pyx_t_6) {
+ __pyx_t_2 = ((__pyx_v_m >= (__pyx_v_e_gaps1[((__pyx_v_k + __pyx_v_step) - 1)])) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1425
+ /* "cdec/sa/rulefactory.pxi":1429
* for m from e_x_gap_low <= m <= e_gap_low[j]:
* if m >= e_gaps1[k+step-1]:
* for n from e_gap_high[j] <= n <= e_x_gap_high: # <<<<<<<<<<<<<<
@@ -56419,17 +60063,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_5 = __pyx_v_e_x_gap_high;
for (__pyx_v_n = (__pyx_v_e_gap_high[__pyx_v_j]); __pyx_v_n <= __pyx_t_5; __pyx_v_n++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1426
+ /* "cdec/sa/rulefactory.pxi":1430
* if m >= e_gaps1[k+step-1]:
* for n from e_gap_high[j] <= n <= e_x_gap_high:
* if n-m >= 1: # extractor.py doesn't restrict target-side gap length # <<<<<<<<<<<<<<
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1)
*/
- __pyx_t_6 = (((__pyx_v_n - __pyx_v_m) >= 1) != 0);
- if (__pyx_t_6) {
+ __pyx_t_2 = (((__pyx_v_n - __pyx_v_m) >= 1) != 0);
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1427
+ /* "cdec/sa/rulefactory.pxi":1431
* for n from e_gap_high[j] <= n <= e_x_gap_high:
* if n-m >= 1: # extractor.py doesn't restrict target-side gap length
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) # <<<<<<<<<<<<<<
@@ -56438,7 +60082,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (__pyx_v_e_gaps1 + __pyx_v_k), __pyx_v_step);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1428
+ /* "cdec/sa/rulefactory.pxi":1432
* if n-m >= 1: # extractor.py doesn't restrict target-side gap length
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1) # <<<<<<<<<<<<<<
@@ -56447,7 +60091,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (&__pyx_v_m), 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1429
+ /* "cdec/sa/rulefactory.pxi":1433
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) # <<<<<<<<<<<<<<
@@ -56455,16 +60099,16 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* free(e_gaps1)
*/
__pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (&__pyx_v_n), 1);
- goto __pyx_L32;
+ goto __pyx_L42;
}
- __pyx_L32:;
+ __pyx_L42:;
}
- goto __pyx_L29;
+ goto __pyx_L39;
}
- __pyx_L29:;
+ __pyx_L39:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1430
+ /* "cdec/sa/rulefactory.pxi":1434
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &m, 1)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1)
* k = k + step # <<<<<<<<<<<<<<
@@ -56474,7 +60118,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_v_k = (__pyx_v_k + __pyx_v_step);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1431
+ /* "cdec/sa/rulefactory.pxi":1435
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1)
* k = k + step
* free(e_gaps1) # <<<<<<<<<<<<<<
@@ -56483,7 +60127,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
free(__pyx_v_e_gaps1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1432
+ /* "cdec/sa/rulefactory.pxi":1436
* k = k + step
* free(e_gaps1)
* e_gaps1 = e_gaps2 # <<<<<<<<<<<<<<
@@ -56492,7 +60136,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps1 = __pyx_v_e_gaps2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1433
+ /* "cdec/sa/rulefactory.pxi":1437
* free(e_gaps1)
* e_gaps1 = e_gaps2
* len1 = len2 # <<<<<<<<<<<<<<
@@ -56502,7 +60146,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_v_len1 = __pyx_v_len2;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1435
+ /* "cdec/sa/rulefactory.pxi":1439
* len1 = len2
*
* step = 1+(num_gaps*2) # <<<<<<<<<<<<<<
@@ -56511,7 +60155,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_step = (1 + (__pyx_v_num_gaps * 2));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1436
+ /* "cdec/sa/rulefactory.pxi":1440
*
* step = 1+(num_gaps*2)
* e_gaps2 = <int*> malloc(0) # <<<<<<<<<<<<<<
@@ -56520,7 +60164,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps2 = ((int *)malloc(0));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1437
+ /* "cdec/sa/rulefactory.pxi":1441
* step = 1+(num_gaps*2)
* e_gaps2 = <int*> malloc(0)
* len2 = 0 # <<<<<<<<<<<<<<
@@ -56529,7 +60173,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_len2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1438
+ /* "cdec/sa/rulefactory.pxi":1442
* e_gaps2 = <int*> malloc(0)
* len2 = 0
* for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<<
@@ -56539,7 +60183,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_3 = __pyx_v_e_x_high;
for (__pyx_v_i = __pyx_v_e_high; __pyx_v_i <= __pyx_t_3; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1439
+ /* "cdec/sa/rulefactory.pxi":1443
* len2 = 0
* for i from e_high <= i <= e_x_high:
* j = 0 # <<<<<<<<<<<<<<
@@ -56548,7 +60192,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_j = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1440
+ /* "cdec/sa/rulefactory.pxi":1444
* for i from e_high <= i <= e_x_high:
* j = 0
* while j < len1: # <<<<<<<<<<<<<<
@@ -56556,10 +60200,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step)
*/
while (1) {
- __pyx_t_6 = ((__pyx_v_j < __pyx_v_len1) != 0);
- if (!__pyx_t_6) break;
+ __pyx_t_2 = ((__pyx_v_j < __pyx_v_len1) != 0);
+ if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1441
+ /* "cdec/sa/rulefactory.pxi":1445
* j = 0
* while j < len1:
* if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: # <<<<<<<<<<<<<<
@@ -56568,14 +60212,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_t_6 = (((__pyx_v_i - (__pyx_v_e_gaps1[__pyx_v_j])) <= __pyx_v_self->train_max_initial_size) != 0);
if (__pyx_t_6) {
- __pyx_t_7 = ((__pyx_v_i >= (__pyx_v_e_gaps1[((__pyx_v_j + __pyx_v_step) - 1)])) != 0);
- __pyx_t_2 = __pyx_t_7;
+ goto __pyx_L49_next_and;
} else {
__pyx_t_2 = __pyx_t_6;
+ goto __pyx_L48_bool_binop_done;
}
+ __pyx_L49_next_and:;
+ __pyx_t_6 = ((__pyx_v_i >= (__pyx_v_e_gaps1[((__pyx_v_j + __pyx_v_step) - 1)])) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L48_bool_binop_done:;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1442
+ /* "cdec/sa/rulefactory.pxi":1446
* while j < len1:
* if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]:
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step) # <<<<<<<<<<<<<<
@@ -56584,7 +60232,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (__pyx_v_e_gaps1 + __pyx_v_j), __pyx_v_step);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1443
+ /* "cdec/sa/rulefactory.pxi":1447
* if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]:
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) # <<<<<<<<<<<<<<
@@ -56592,11 +60240,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* free(e_gaps1)
*/
__pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->int_arr_extend(__pyx_v_self, __pyx_v_e_gaps2, (&__pyx_v_len2), (&__pyx_v_i), 1);
- goto __pyx_L37;
+ goto __pyx_L47;
}
- __pyx_L37:;
+ __pyx_L47:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1444
+ /* "cdec/sa/rulefactory.pxi":1448
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+j, step)
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1)
* j = j + step # <<<<<<<<<<<<<<
@@ -56607,7 +60255,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1445
+ /* "cdec/sa/rulefactory.pxi":1449
* e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1)
* j = j + step
* free(e_gaps1) # <<<<<<<<<<<<<<
@@ -56616,7 +60264,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
free(__pyx_v_e_gaps1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1446
+ /* "cdec/sa/rulefactory.pxi":1450
* j = j + step
* free(e_gaps1)
* e_gaps1 = e_gaps2 # <<<<<<<<<<<<<<
@@ -56625,7 +60273,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_e_gaps1 = __pyx_v_e_gaps2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1447
+ /* "cdec/sa/rulefactory.pxi":1451
* free(e_gaps1)
* e_gaps1 = e_gaps2
* len1 = len2 # <<<<<<<<<<<<<<
@@ -56634,7 +60282,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_len1 = __pyx_v_len2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1449
+ /* "cdec/sa/rulefactory.pxi":1453
* len1 = len2
*
* step = (num_gaps+1)*2 # <<<<<<<<<<<<<<
@@ -56643,7 +60291,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_step = ((__pyx_v_num_gaps + 1) * 2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1450
+ /* "cdec/sa/rulefactory.pxi":1454
*
* step = (num_gaps+1)*2
* i = 0 # <<<<<<<<<<<<<<
@@ -56652,7 +60300,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_i = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1453
+ /* "cdec/sa/rulefactory.pxi":1457
*
* cdef IntList indexes
* while i < len1: # <<<<<<<<<<<<<<
@@ -56663,7 +60311,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = ((__pyx_v_i < __pyx_v_len1) != 0);
if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1454
+ /* "cdec/sa/rulefactory.pxi":1458
* cdef IntList indexes
* while i < len1:
* ephr_arr._clear() # <<<<<<<<<<<<<<
@@ -56672,7 +60320,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1455
+ /* "cdec/sa/rulefactory.pxi":1459
* while i < len1:
* ephr_arr._clear()
* num_chunks = 0 # <<<<<<<<<<<<<<
@@ -56681,29 +60329,29 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_num_chunks = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1456
+ /* "cdec/sa/rulefactory.pxi":1460
* ephr_arr._clear()
* num_chunks = 0
* indexes = IntList() # <<<<<<<<<<<<<<
* for j from 0 <= j < num_gaps+1:
* if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]:
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_indexes, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1));
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1457
+ /* "cdec/sa/rulefactory.pxi":1461
* num_chunks = 0
* indexes = IntList()
* for j from 0 <= j < num_gaps+1: # <<<<<<<<<<<<<<
* if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]:
* num_chunks = num_chunks + 1
*/
- __pyx_t_9 = (__pyx_v_num_gaps + 1);
- for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_9; __pyx_v_j++) {
+ __pyx_t_7 = (__pyx_v_num_gaps + 1);
+ for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1458
+ /* "cdec/sa/rulefactory.pxi":1462
* indexes = IntList()
* for j from 0 <= j < num_gaps+1:
* if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<<
@@ -56713,7 +60361,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = (((__pyx_v_e_gaps1[(__pyx_v_i + (2 * __pyx_v_j))]) < (__pyx_v_e_gaps1[((__pyx_v_i + (2 * __pyx_v_j)) + 1)])) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1459
+ /* "cdec/sa/rulefactory.pxi":1463
* for j from 0 <= j < num_gaps+1:
* if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]:
* num_chunks = num_chunks + 1 # <<<<<<<<<<<<<<
@@ -56721,11 +60369,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* indexes.append(k)
*/
__pyx_v_num_chunks = (__pyx_v_num_chunks + 1);
- goto __pyx_L42;
+ goto __pyx_L54;
}
- __pyx_L42:;
+ __pyx_L54:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1460
+ /* "cdec/sa/rulefactory.pxi":1464
* if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]:
* num_chunks = num_chunks + 1
* for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<<
@@ -56735,19 +60383,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_3 = (__pyx_v_e_gaps1[((__pyx_v_i + (2 * __pyx_v_j)) + 1)]);
for (__pyx_v_k = (__pyx_v_e_gaps1[(__pyx_v_i + (2 * __pyx_v_j))]); __pyx_v_k < __pyx_t_3; __pyx_v_k++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1461
+ /* "cdec/sa/rulefactory.pxi":1465
* num_chunks = num_chunks + 1
* for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]:
* indexes.append(k) # <<<<<<<<<<<<<<
* ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]])
* if j < num_gaps:
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1462
+ /* "cdec/sa/rulefactory.pxi":1466
* for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]:
* indexes.append(k)
* ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) # <<<<<<<<<<<<<<
@@ -56755,14 +60403,14 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* indexes.append(sym_setindex(self.category, e_gap_order[j]+1))
*/
__pyx_t_4 = (__pyx_v_self->eda->data->arr[(__pyx_v_e_sent_start + __pyx_v_k)]);
- __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1463
+ /* "cdec/sa/rulefactory.pxi":1467
* indexes.append(k)
* ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]])
* if j < num_gaps: # <<<<<<<<<<<<<<
@@ -56772,19 +60420,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_t_2 = ((__pyx_v_j < __pyx_v_num_gaps) != 0);
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1464
+ /* "cdec/sa/rulefactory.pxi":1468
* ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]])
* if j < num_gaps:
* indexes.append(sym_setindex(self.category, e_gap_order[j]+1)) # <<<<<<<<<<<<<<
* ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1))
* i = i + step
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1465
+ /* "cdec/sa/rulefactory.pxi":1469
* if j < num_gaps:
* indexes.append(sym_setindex(self.category, e_gap_order[j]+1))
* ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1)) # <<<<<<<<<<<<<<
@@ -56792,12 +60440,12 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
* if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks:
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1)));
- goto __pyx_L45;
+ goto __pyx_L57;
}
- __pyx_L45:;
+ __pyx_L57:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1466
+ /* "cdec/sa/rulefactory.pxi":1470
* indexes.append(sym_setindex(self.category, e_gap_order[j]+1))
* ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1))
* i = i + step # <<<<<<<<<<<<<<
@@ -56806,53 +60454,57 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
__pyx_v_i = (__pyx_v_i + __pyx_v_step);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1467
+ /* "cdec/sa/rulefactory.pxi":1471
* ephr_arr._append(sym_setindex(self.category, e_gap_order[j]+1))
* i = i + step
* if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: # <<<<<<<<<<<<<<
* result.append((Phrase(ephr_arr),indexes))
*
*/
- __pyx_t_2 = ((__pyx_v_ephr_arr->len <= __pyx_v_self->max_target_length) != 0);
- if (__pyx_t_2) {
- __pyx_t_6 = ((__pyx_v_num_chunks <= __pyx_v_self->max_target_chunks) != 0);
- __pyx_t_7 = __pyx_t_6;
+ __pyx_t_6 = ((__pyx_v_ephr_arr->len <= __pyx_v_self->max_target_length) != 0);
+ if (__pyx_t_6) {
+ goto __pyx_L60_next_and;
} else {
- __pyx_t_7 = __pyx_t_2;
+ __pyx_t_2 = __pyx_t_6;
+ goto __pyx_L59_bool_binop_done;
}
- if (__pyx_t_7) {
+ __pyx_L60_next_and:;
+ __pyx_t_6 = ((__pyx_v_num_chunks <= __pyx_v_self->max_target_chunks) != 0);
+ __pyx_t_2 = __pyx_t_6;
+ __pyx_L59_bool_binop_done:;
+ if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1468
+ /* "cdec/sa/rulefactory.pxi":1472
* i = i + step
* if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks:
* result.append((Phrase(ephr_arr),indexes)) # <<<<<<<<<<<<<<
*
* free(e_gaps1)
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_v_ephr_arr));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_ephr_arr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_ephr_arr));
- __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
+ __Pyx_GIVEREF(__pyx_t_9);
__Pyx_INCREF(((PyObject *)__pyx_v_indexes));
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_indexes));
__Pyx_GIVEREF(((PyObject *)__pyx_v_indexes));
- __pyx_t_11 = 0;
- __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L46;
+ goto __pyx_L58;
}
- __pyx_L46:;
+ __pyx_L58:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1470
+ /* "cdec/sa/rulefactory.pxi":1474
* result.append((Phrase(ephr_arr),indexes))
*
* free(e_gaps1) # <<<<<<<<<<<<<<
@@ -56861,7 +60513,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
free(__pyx_v_e_gaps1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1471
+ /* "cdec/sa/rulefactory.pxi":1475
*
* free(e_gaps1)
* free(e_gap_order) # <<<<<<<<<<<<<<
@@ -56870,7 +60522,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
*/
free(__pyx_v_e_gap_order);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1472
+ /* "cdec/sa/rulefactory.pxi":1476
* free(e_gaps1)
* free(e_gap_order)
* return result # <<<<<<<<<<<<<<
@@ -56882,7 +60534,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
__pyx_r = __pyx_v_result;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1370
+ /* "cdec/sa/rulefactory.pxi":1370
*
*
* cdef extract_phrases(self, int e_low, int e_high, int* e_gap_low, int* e_gap_high, int* e_links_low, int num_gaps, # <<<<<<<<<<<<<<
@@ -56893,7 +60545,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -56905,7 +60557,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrase
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1474
+/* "cdec/sa/rulefactory.pxi":1478
* return result
*
* cdef IntList create_alignments(self, int* sent_links, int num_links, # <<<<<<<<<<<<<<
@@ -56928,25 +60580,27 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
PyObject *__pyx_t_5 = NULL;
Py_ssize_t __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
- int __pyx_t_8;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ int __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("create_alignments", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1477
+ /* "cdec/sa/rulefactory.pxi":1481
* IntList findexes, IntList eindexes):
* cdef unsigned i
* cdef IntList ret = IntList() # <<<<<<<<<<<<<<
* for i in range(findexes.len):
* s = findexes.arr[i]
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_ret = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1478
+ /* "cdec/sa/rulefactory.pxi":1482
* cdef unsigned i
* cdef IntList ret = IntList()
* for i in range(findexes.len): # <<<<<<<<<<<<<<
@@ -56957,7 +60611,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1479
+ /* "cdec/sa/rulefactory.pxi":1483
* cdef IntList ret = IntList()
* for i in range(findexes.len):
* s = findexes.arr[i] # <<<<<<<<<<<<<<
@@ -56966,7 +60620,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
*/
__pyx_v_s = (__pyx_v_findexes->arr[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1480
+ /* "cdec/sa/rulefactory.pxi":1484
* for i in range(findexes.len):
* s = findexes.arr[i]
* if s < 0: continue # <<<<<<<<<<<<<<
@@ -56978,7 +60632,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
goto __pyx_L3_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1481
+ /* "cdec/sa/rulefactory.pxi":1485
* s = findexes.arr[i]
* if s < 0: continue
* idx = 0 # <<<<<<<<<<<<<<
@@ -56988,7 +60642,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_idx, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1482
+ /* "cdec/sa/rulefactory.pxi":1486
* if s < 0: continue
* idx = 0
* while idx < num_links * 2: # <<<<<<<<<<<<<<
@@ -56996,86 +60650,103 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
* j = eindexes.index(sent_links[idx+1])
*/
while (1) {
- __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (!__pyx_t_4) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1483
+ /* "cdec/sa/rulefactory.pxi":1487
* idx = 0
* while idx < num_links * 2:
* if sent_links[idx] == s: # <<<<<<<<<<<<<<
* j = eindexes.index(sent_links[idx+1])
* ret.append(i * ALIGNMENT_CODE + j)
*/
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = (((__pyx_v_sent_links[__pyx_t_6]) == __pyx_v_s) != 0);
if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1484
+ /* "cdec/sa/rulefactory.pxi":1488
* while idx < num_links * 2:
* if sent_links[idx] == s:
* j = eindexes.index(sent_links[idx+1]) # <<<<<<<<<<<<<<
* ret.append(i * ALIGNMENT_CODE + j)
* idx += 2
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_eindexes), __pyx_n_s_index); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_1 = PyNumber_Add(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_eindexes), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyNumber_Add(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_8) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_9);
+ PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1485
+ /* "cdec/sa/rulefactory.pxi":1489
* if sent_links[idx] == s:
* j = eindexes.index(sent_links[idx+1])
* ret.append(i * ALIGNMENT_CODE + j) # <<<<<<<<<<<<<<
* idx += 2
* return ret
*/
- __pyx_t_1 = __Pyx_PyInt_From_unsigned_int((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyInt_From_unsigned_int((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L8;
}
__pyx_L8:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1486
+ /* "cdec/sa/rulefactory.pxi":1490
* j = eindexes.index(sent_links[idx+1])
* ret.append(i * ALIGNMENT_CODE + j)
* idx += 2 # <<<<<<<<<<<<<<
* return ret
*
*/
- __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_7);
- __pyx_t_7 = 0;
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_1);
+ __pyx_t_1 = 0;
}
__pyx_L3_continue:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1487
+ /* "cdec/sa/rulefactory.pxi":1491
* ret.append(i * ALIGNMENT_CODE + j)
* idx += 2
* return ret # <<<<<<<<<<<<<<
@@ -57087,7 +60758,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
__pyx_r = __pyx_v_ret;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1474
+ /* "cdec/sa/rulefactory.pxi":1478
* return result
*
* cdef IntList create_alignments(self, int* sent_links, int num_links, # <<<<<<<<<<<<<<
@@ -57100,6 +60771,8 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -57111,12 +60784,12 @@ static struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_f_4cdec_2sa_3_sa_23HieroCa
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1489
+/* "cdec/sa/rulefactory.pxi":1493
* return ret
*
* cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): # <<<<<<<<<<<<<<
- * cdef int* sent_links, *e_links_low, *e_links_high, *f_links_low, *f_links_high
- * cdef int *f_gap_low, *f_gap_high, *e_gap_low, *e_gap_high, num_gaps, gap_start
+ * cdef int *sent_links
+ * cdef int *e_links_low
*/
static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_phrase, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_matching, int *__pyx_v_chunklen, int __pyx_v_num_chunks) {
@@ -57178,46 +60851,37 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
+ PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
int __pyx_t_10;
- PyObject *__pyx_t_11 = NULL;
- long __pyx_t_12;
+ long __pyx_t_11;
+ PyObject *__pyx_t_12 = NULL;
Py_ssize_t __pyx_t_13;
PyObject *__pyx_t_14 = NULL;
- PyObject *__pyx_t_15 = NULL;
+ PyObject *(*__pyx_t_15)(PyObject *);
PyObject *(*__pyx_t_16)(PyObject *);
- PyObject *(*__pyx_t_17)(PyObject *);
- int __pyx_t_18;
- int __pyx_t_19;
- int __pyx_t_20;
- int __pyx_t_21;
- int __pyx_t_22;
- int __pyx_t_23;
- int __pyx_t_24;
- int __pyx_t_25;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("extract", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1502
+ /* "cdec/sa/rulefactory.pxi":1514
* cdef reason_for_failure
*
* fphr_arr = IntList() # <<<<<<<<<<<<<<
* phrase_len = phrase.n
* extracts = []
*/
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_fphr_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1503
+ /* "cdec/sa/rulefactory.pxi":1515
*
* fphr_arr = IntList()
* phrase_len = phrase.n # <<<<<<<<<<<<<<
@@ -57227,19 +60891,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_phrase->n;
__pyx_v_phrase_len = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1504
+ /* "cdec/sa/rulefactory.pxi":1516
* fphr_arr = IntList()
* phrase_len = phrase.n
* extracts = [] # <<<<<<<<<<<<<<
* sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links)
*
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_extracts = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1505
+ /* "cdec/sa/rulefactory.pxi":1517
* phrase_len = phrase.n
* extracts = []
* sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) # <<<<<<<<<<<<<<
@@ -57248,7 +60912,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_sent_links = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->alignment->__pyx_vtab)->_get_sent_links(__pyx_v_self->alignment, __pyx_v_matching->sent_id, (&__pyx_v_num_links));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1507
+ /* "cdec/sa/rulefactory.pxi":1519
* sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links)
*
* e_sent_start = self.eda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<<
@@ -57257,7 +60921,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_sent_start = (__pyx_v_self->eda->sent_index->arr[__pyx_v_matching->sent_id]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1508
+ /* "cdec/sa/rulefactory.pxi":1520
*
* e_sent_start = self.eda.sent_index.arr[matching.sent_id]
* e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<<
@@ -57266,7 +60930,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_sent_end = (__pyx_v_self->eda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1509
+ /* "cdec/sa/rulefactory.pxi":1521
* e_sent_start = self.eda.sent_index.arr[matching.sent_id]
* e_sent_end = self.eda.sent_index.arr[matching.sent_id+1]
* e_sent_len = e_sent_end - e_sent_start - 1 # <<<<<<<<<<<<<<
@@ -57275,7 +60939,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_sent_len = ((__pyx_v_e_sent_end - __pyx_v_e_sent_start) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1510
+ /* "cdec/sa/rulefactory.pxi":1522
* e_sent_end = self.eda.sent_index.arr[matching.sent_id+1]
* e_sent_len = e_sent_end - e_sent_start - 1
* f_sent_start = self.fda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<<
@@ -57284,7 +60948,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_sent_start = (__pyx_v_self->fda->sent_index->arr[__pyx_v_matching->sent_id]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1511
+ /* "cdec/sa/rulefactory.pxi":1523
* e_sent_len = e_sent_end - e_sent_start - 1
* f_sent_start = self.fda.sent_index.arr[matching.sent_id]
* f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<<
@@ -57293,7 +60957,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_sent_end = (__pyx_v_self->fda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1512
+ /* "cdec/sa/rulefactory.pxi":1524
* f_sent_start = self.fda.sent_index.arr[matching.sent_id]
* f_sent_end = self.fda.sent_index.arr[matching.sent_id+1]
* f_sent_len = f_sent_end - f_sent_start - 1 # <<<<<<<<<<<<<<
@@ -57302,21 +60966,36 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_sent_len = ((__pyx_v_f_sent_end - __pyx_v_f_sent_start) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1514
+ /* "cdec/sa/rulefactory.pxi":1526
* f_sent_len = f_sent_end - f_sent_start - 1
*
* self.findexes1.reset() # <<<<<<<<<<<<<<
* sofar = 0
* for i in range(num_chunks):
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes1), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes1), __pyx_n_s_reset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1515
+ /* "cdec/sa/rulefactory.pxi":1527
*
* self.findexes1.reset()
* sofar = 0 # <<<<<<<<<<<<<<
@@ -57326,7 +61005,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_int_0);
__pyx_v_sofar = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1516
+ /* "cdec/sa/rulefactory.pxi":1528
* self.findexes1.reset()
* sofar = 0
* for i in range(num_chunks): # <<<<<<<<<<<<<<
@@ -57334,84 +61013,84 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start);
*/
__pyx_t_2 = __pyx_v_num_chunks;
- for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) {
- __pyx_v_i = __pyx_t_4;
+ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
+ __pyx_v_i = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1517
+ /* "cdec/sa/rulefactory.pxi":1529
* sofar = 0
* for i in range(num_chunks):
* for j in range(chunklen[i]): # <<<<<<<<<<<<<<
* self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start);
* sofar += 1
*/
- __pyx_t_5 = (__pyx_v_chunklen[__pyx_v_i]);
- for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
- __pyx_v_j = __pyx_t_6;
+ __pyx_t_6 = (__pyx_v_chunklen[__pyx_v_i]);
+ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
+ __pyx_v_j = __pyx_t_7;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1518
+ /* "cdec/sa/rulefactory.pxi":1530
* for i in range(num_chunks):
* for j in range(chunklen[i]):
* self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); # <<<<<<<<<<<<<<
* sofar += 1
* if i+1 < num_chunks:
*/
- __pyx_t_3 = __Pyx_PyInt_From_int((((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + __pyx_v_j) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyInt_From_int((((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + __pyx_v_j) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1519
+ /* "cdec/sa/rulefactory.pxi":1531
* for j in range(chunklen[i]):
* self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start);
* sofar += 1 # <<<<<<<<<<<<<<
* if i+1 < num_chunks:
* self.findexes1.append(phrase[sofar])
*/
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_1);
+ __pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1520
+ /* "cdec/sa/rulefactory.pxi":1532
* self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start);
* sofar += 1
* if i+1 < num_chunks: # <<<<<<<<<<<<<<
* self.findexes1.append(phrase[sofar])
* sofar += 1
*/
- __pyx_t_8 = (((__pyx_v_i + 1) < __pyx_v_num_chunks) != 0);
- if (__pyx_t_8) {
+ __pyx_t_9 = (((__pyx_v_i + 1) < __pyx_v_num_chunks) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1521
+ /* "cdec/sa/rulefactory.pxi":1533
* sofar += 1
* if i+1 < num_chunks:
* self.findexes1.append(phrase[sofar]) # <<<<<<<<<<<<<<
* sofar += 1
*
*/
- __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1522
+ /* "cdec/sa/rulefactory.pxi":1534
* if i+1 < num_chunks:
* self.findexes1.append(phrase[sofar])
* sofar += 1 # <<<<<<<<<<<<<<
*
*
*/
- __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF_SET(__pyx_v_sofar, __pyx_t_1);
+ __pyx_t_1 = 0;
goto __pyx_L7;
}
__pyx_L7:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1525
+ /* "cdec/sa/rulefactory.pxi":1537
*
*
* e_links_low = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57420,7 +61099,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1526
+ /* "cdec/sa/rulefactory.pxi":1538
*
* e_links_low = <int*> malloc(e_sent_len*sizeof(int))
* e_links_high = <int*> malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57429,7 +61108,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1527
+ /* "cdec/sa/rulefactory.pxi":1539
* e_links_low = <int*> malloc(e_sent_len*sizeof(int))
* e_links_high = <int*> malloc(e_sent_len*sizeof(int))
* f_links_low = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57438,7 +61117,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1528
+ /* "cdec/sa/rulefactory.pxi":1540
* e_links_high = <int*> malloc(e_sent_len*sizeof(int))
* f_links_low = <int*> malloc(f_sent_len*sizeof(int))
* f_links_high = <int*> malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57447,7 +61126,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1529
+ /* "cdec/sa/rulefactory.pxi":1541
* f_links_low = <int*> malloc(f_sent_len*sizeof(int))
* f_links_high = <int*> malloc(f_sent_len*sizeof(int))
* f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57456,7 +61135,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1530
+ /* "cdec/sa/rulefactory.pxi":1542
* f_links_high = <int*> malloc(f_sent_len*sizeof(int))
* f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int))
* f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57465,7 +61144,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1531
+ /* "cdec/sa/rulefactory.pxi":1543
* f_gap_low = <int*> malloc((num_chunks+1)*sizeof(int))
* f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int))
* e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57474,7 +61153,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1532
+ /* "cdec/sa/rulefactory.pxi":1544
* f_gap_high = <int*> malloc((num_chunks+1)*sizeof(int))
* e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int))
* e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57483,7 +61162,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int)))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1533
+ /* "cdec/sa/rulefactory.pxi":1545
* e_gap_low = <int*> malloc((num_chunks+1)*sizeof(int))
* e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int))
* memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57492,7 +61171,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1534
+ /* "cdec/sa/rulefactory.pxi":1546
* e_gap_high = <int*> malloc((num_chunks+1)*sizeof(int))
* memset(f_gap_low, 0, (num_chunks+1)*sizeof(int))
* memset(f_gap_high, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57501,7 +61180,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1535
+ /* "cdec/sa/rulefactory.pxi":1547
* memset(f_gap_low, 0, (num_chunks+1)*sizeof(int))
* memset(f_gap_high, 0, (num_chunks+1)*sizeof(int))
* memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57510,7 +61189,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1536
+ /* "cdec/sa/rulefactory.pxi":1548
* memset(f_gap_high, 0, (num_chunks+1)*sizeof(int))
* memset(e_gap_low, 0, (num_chunks+1)*sizeof(int))
* memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<<
@@ -57519,7 +61198,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int))));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1538
+ /* "cdec/sa/rulefactory.pxi":1550
* memset(e_gap_high, 0, (num_chunks+1)*sizeof(int))
*
* reason_for_failure = "" # <<<<<<<<<<<<<<
@@ -57529,7 +61208,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s__32);
__pyx_v_reason_for_failure = __pyx_kp_s__32;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1540
+ /* "cdec/sa/rulefactory.pxi":1552
* reason_for_failure = ""
*
* for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<<
@@ -57539,7 +61218,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_e_sent_len;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1541
+ /* "cdec/sa/rulefactory.pxi":1553
*
* for i from 0 <= i < e_sent_len:
* e_links_low[i] = -1 # <<<<<<<<<<<<<<
@@ -57548,7 +61227,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_e_links_low[__pyx_v_i]) = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1542
+ /* "cdec/sa/rulefactory.pxi":1554
* for i from 0 <= i < e_sent_len:
* e_links_low[i] = -1
* e_links_high[i] = -1 # <<<<<<<<<<<<<<
@@ -57558,7 +61237,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
(__pyx_v_e_links_high[__pyx_v_i]) = -1;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1543
+ /* "cdec/sa/rulefactory.pxi":1555
* e_links_low[i] = -1
* e_links_high[i] = -1
* for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<<
@@ -57568,7 +61247,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_f_sent_len;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1544
+ /* "cdec/sa/rulefactory.pxi":1556
* e_links_high[i] = -1
* for i from 0 <= i < f_sent_len:
* f_links_low[i] = -1 # <<<<<<<<<<<<<<
@@ -57577,7 +61256,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_links_low[__pyx_v_i]) = -1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1545
+ /* "cdec/sa/rulefactory.pxi":1557
* for i from 0 <= i < f_sent_len:
* f_links_low[i] = -1
* f_links_high[i] = -1 # <<<<<<<<<<<<<<
@@ -57587,7 +61266,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
(__pyx_v_f_links_high[__pyx_v_i]) = -1;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1551
+ /* "cdec/sa/rulefactory.pxi":1563
* # links that we care about (but then how to look up
* # when we want to check something on the e side?)
* i = 0 # <<<<<<<<<<<<<<
@@ -57596,7 +61275,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1552
+ /* "cdec/sa/rulefactory.pxi":1564
* # when we want to check something on the e side?)
* i = 0
* while i < num_links*2: # <<<<<<<<<<<<<<
@@ -57604,10 +61283,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* e_i = sent_links[i+1]
*/
while (1) {
- __pyx_t_8 = ((__pyx_v_i < (__pyx_v_num_links * 2)) != 0);
- if (!__pyx_t_8) break;
+ __pyx_t_9 = ((__pyx_v_i < (__pyx_v_num_links * 2)) != 0);
+ if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1553
+ /* "cdec/sa/rulefactory.pxi":1565
* i = 0
* while i < num_links*2:
* f_i = sent_links[i] # <<<<<<<<<<<<<<
@@ -57616,7 +61295,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1554
+ /* "cdec/sa/rulefactory.pxi":1566
* while i < num_links*2:
* f_i = sent_links[i]
* e_i = sent_links[i+1] # <<<<<<<<<<<<<<
@@ -57625,23 +61304,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1555
+ /* "cdec/sa/rulefactory.pxi":1567
* f_i = sent_links[i]
* e_i = sent_links[i+1]
* if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i: # <<<<<<<<<<<<<<
* f_links_low[f_i] = e_i
* if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1:
*/
- __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_i]) == -1) != 0);
- if (!__pyx_t_8) {
- __pyx_t_9 = (((__pyx_v_f_links_low[__pyx_v_f_i]) > __pyx_v_e_i) != 0);
- __pyx_t_10 = __pyx_t_9;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_i]) == -1) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L16_next_or;
} else {
- __pyx_t_10 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L15_bool_binop_done;
}
- if (__pyx_t_10) {
+ __pyx_L16_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_i]) > __pyx_v_e_i) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L15_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1556
+ /* "cdec/sa/rulefactory.pxi":1568
* e_i = sent_links[i+1]
* if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i:
* f_links_low[f_i] = e_i # <<<<<<<<<<<<<<
@@ -57653,7 +61336,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
}
__pyx_L14:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1557
+ /* "cdec/sa/rulefactory.pxi":1569
* if f_links_low[f_i] == -1 or f_links_low[f_i] > e_i:
* f_links_low[f_i] = e_i
* if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1: # <<<<<<<<<<<<<<
@@ -57662,14 +61345,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_t_10 = (((__pyx_v_f_links_high[__pyx_v_f_i]) == -1) != 0);
if (!__pyx_t_10) {
- __pyx_t_8 = (((__pyx_v_f_links_high[__pyx_v_f_i]) < (__pyx_v_e_i + 1)) != 0);
- __pyx_t_9 = __pyx_t_8;
+ goto __pyx_L19_next_or;
} else {
__pyx_t_9 = __pyx_t_10;
+ goto __pyx_L18_bool_binop_done;
}
+ __pyx_L19_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_high[__pyx_v_f_i]) < (__pyx_v_e_i + 1)) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L18_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1558
+ /* "cdec/sa/rulefactory.pxi":1570
* f_links_low[f_i] = e_i
* if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1:
* f_links_high[f_i] = e_i + 1 # <<<<<<<<<<<<<<
@@ -57677,27 +61364,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* e_links_low[e_i] = f_i
*/
(__pyx_v_f_links_high[__pyx_v_f_i]) = (__pyx_v_e_i + 1);
- goto __pyx_L15;
+ goto __pyx_L17;
}
- __pyx_L15:;
+ __pyx_L17:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1559
+ /* "cdec/sa/rulefactory.pxi":1571
* if f_links_high[f_i] == -1 or f_links_high[f_i] < e_i + 1:
* f_links_high[f_i] = e_i + 1
* if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: # <<<<<<<<<<<<<<
* e_links_low[e_i] = f_i
* if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1:
*/
- __pyx_t_9 = (((__pyx_v_e_links_low[__pyx_v_e_i]) == -1) != 0);
- if (!__pyx_t_9) {
- __pyx_t_10 = (((__pyx_v_e_links_low[__pyx_v_e_i]) > __pyx_v_f_i) != 0);
- __pyx_t_8 = __pyx_t_10;
+ __pyx_t_10 = (((__pyx_v_e_links_low[__pyx_v_e_i]) == -1) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L22_next_or;
} else {
- __pyx_t_8 = __pyx_t_9;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L21_bool_binop_done;
}
- if (__pyx_t_8) {
+ __pyx_L22_next_or:;
+ __pyx_t_10 = (((__pyx_v_e_links_low[__pyx_v_e_i]) > __pyx_v_f_i) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L21_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1560
+ /* "cdec/sa/rulefactory.pxi":1572
* f_links_high[f_i] = e_i + 1
* if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i:
* e_links_low[e_i] = f_i # <<<<<<<<<<<<<<
@@ -57705,27 +61396,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* e_links_high[e_i] = f_i + 1
*/
(__pyx_v_e_links_low[__pyx_v_e_i]) = __pyx_v_f_i;
- goto __pyx_L16;
+ goto __pyx_L20;
}
- __pyx_L16:;
+ __pyx_L20:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1561
+ /* "cdec/sa/rulefactory.pxi":1573
* if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i:
* e_links_low[e_i] = f_i
* if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1: # <<<<<<<<<<<<<<
* e_links_high[e_i] = f_i + 1
* i = i + 2
*/
- __pyx_t_8 = (((__pyx_v_e_links_high[__pyx_v_e_i]) == -1) != 0);
- if (!__pyx_t_8) {
- __pyx_t_9 = (((__pyx_v_e_links_high[__pyx_v_e_i]) < (__pyx_v_f_i + 1)) != 0);
- __pyx_t_10 = __pyx_t_9;
+ __pyx_t_10 = (((__pyx_v_e_links_high[__pyx_v_e_i]) == -1) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L25_next_or;
} else {
- __pyx_t_10 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L24_bool_binop_done;
}
- if (__pyx_t_10) {
+ __pyx_L25_next_or:;
+ __pyx_t_10 = (((__pyx_v_e_links_high[__pyx_v_e_i]) < (__pyx_v_f_i + 1)) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L24_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1562
+ /* "cdec/sa/rulefactory.pxi":1574
* e_links_low[e_i] = f_i
* if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1:
* e_links_high[e_i] = f_i + 1 # <<<<<<<<<<<<<<
@@ -57733,11 +61428,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*
*/
(__pyx_v_e_links_high[__pyx_v_e_i]) = (__pyx_v_f_i + 1);
- goto __pyx_L17;
+ goto __pyx_L23;
}
- __pyx_L17:;
+ __pyx_L23:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1563
+ /* "cdec/sa/rulefactory.pxi":1575
* if e_links_high[e_i] == -1 or e_links_high[e_i] < f_i + 1:
* e_links_high[e_i] = f_i + 1
* i = i + 2 # <<<<<<<<<<<<<<
@@ -57747,19 +61442,19 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_v_i = (__pyx_v_i + 2);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1565
+ /* "cdec/sa/rulefactory.pxi":1577
* i = i + 2
*
* als = [] # <<<<<<<<<<<<<<
* for x in range(matching.start,matching.end):
* al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start])
*/
- __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_v_als = ((PyObject*)__pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_als = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1566
+ /* "cdec/sa/rulefactory.pxi":1578
*
* als = []
* for x in range(matching.start,matching.end): # <<<<<<<<<<<<<<
@@ -57767,42 +61462,42 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* als.append(al)
*/
__pyx_t_2 = __pyx_v_matching->end;
- for (__pyx_t_4 = __pyx_v_matching->start; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) {
- __pyx_v_x = __pyx_t_4;
+ for (__pyx_t_5 = __pyx_v_matching->start; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) {
+ __pyx_v_x = __pyx_t_5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1567
+ /* "cdec/sa/rulefactory.pxi":1579
* als = []
* for x in range(matching.start,matching.end):
* al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start]) # <<<<<<<<<<<<<<
* als.append(al)
* # check all source-side alignment constraints
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_f_links_low[((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_f_links_low[((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__pyx_t_1 = 0;
- __Pyx_XDECREF_SET(__pyx_v_al, ((PyObject*)__pyx_t_11));
- __pyx_t_11 = 0;
+ __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_al, ((PyObject*)__pyx_t_4));
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1568
+ /* "cdec/sa/rulefactory.pxi":1580
* for x in range(matching.start,matching.end):
* al = (matching.arr[x]-f_sent_start,f_links_low[matching.arr[x]-f_sent_start])
* als.append(al) # <<<<<<<<<<<<<<
* # check all source-side alignment constraints
* met_constraints = 1
*/
- __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_als, __pyx_v_al); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_als, __pyx_v_al); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1570
+ /* "cdec/sa/rulefactory.pxi":1582
* als.append(al)
* # check all source-side alignment constraints
* met_constraints = 1 # <<<<<<<<<<<<<<
@@ -57811,17 +61506,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1571
+ /* "cdec/sa/rulefactory.pxi":1583
* # check all source-side alignment constraints
* met_constraints = 1
* if self.require_aligned_terminal: # <<<<<<<<<<<<<<
* num_aligned_chunks = 0
* for i from 0 <= i < num_chunks:
*/
- __pyx_t_10 = (__pyx_v_self->require_aligned_terminal != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_self->require_aligned_terminal != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1572
+ /* "cdec/sa/rulefactory.pxi":1584
* met_constraints = 1
* if self.require_aligned_terminal:
* num_aligned_chunks = 0 # <<<<<<<<<<<<<<
@@ -57830,7 +61525,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_num_aligned_chunks = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1573
+ /* "cdec/sa/rulefactory.pxi":1585
* if self.require_aligned_terminal:
* num_aligned_chunks = 0
* for i from 0 <= i < num_chunks: # <<<<<<<<<<<<<<
@@ -57840,27 +61535,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_num_chunks;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1574
+ /* "cdec/sa/rulefactory.pxi":1586
* num_aligned_chunks = 0
* for i from 0 <= i < num_chunks:
* for j from 0 <= j < chunklen[i]: # <<<<<<<<<<<<<<
* if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1:
* num_aligned_chunks = num_aligned_chunks + 1
*/
- __pyx_t_4 = (__pyx_v_chunklen[__pyx_v_i]);
- for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) {
+ __pyx_t_5 = (__pyx_v_chunklen[__pyx_v_i]);
+ for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_5; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1575
+ /* "cdec/sa/rulefactory.pxi":1587
* for i from 0 <= i < num_chunks:
* for j from 0 <= j < chunklen[i]:
* if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: # <<<<<<<<<<<<<<
* num_aligned_chunks = num_aligned_chunks + 1
* break
*/
- __pyx_t_10 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + __pyx_v_j) - __pyx_v_f_sent_start)]) > -1) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + __pyx_v_j) - __pyx_v_f_sent_start)]) > -1) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1576
+ /* "cdec/sa/rulefactory.pxi":1588
* for j from 0 <= j < chunklen[i]:
* if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1:
* num_aligned_chunks = num_aligned_chunks + 1 # <<<<<<<<<<<<<<
@@ -57869,30 +61564,30 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1577
+ /* "cdec/sa/rulefactory.pxi":1589
* if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1:
* num_aligned_chunks = num_aligned_chunks + 1
* break # <<<<<<<<<<<<<<
* if num_aligned_chunks == 0:
* reason_for_failure = "No aligned terminals"
*/
- goto __pyx_L24_break;
+ goto __pyx_L32_break;
}
}
- __pyx_L24_break:;
+ __pyx_L32_break:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1578
+ /* "cdec/sa/rulefactory.pxi":1590
* num_aligned_chunks = num_aligned_chunks + 1
* break
* if num_aligned_chunks == 0: # <<<<<<<<<<<<<<
* reason_for_failure = "No aligned terminals"
* met_constraints = 0
*/
- __pyx_t_10 = ((__pyx_v_num_aligned_chunks == 0) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_num_aligned_chunks == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1579
+ /* "cdec/sa/rulefactory.pxi":1591
* break
* if num_aligned_chunks == 0:
* reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<<
@@ -57902,7 +61597,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s_No_aligned_terminals);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_No_aligned_terminals);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1580
+ /* "cdec/sa/rulefactory.pxi":1592
* if num_aligned_chunks == 0:
* reason_for_failure = "No aligned terminals"
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -57910,26 +61605,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* reason_for_failure = "Unaligned chunk"
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L26;
+ goto __pyx_L34;
}
- __pyx_L26:;
+ __pyx_L34:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1581
+ /* "cdec/sa/rulefactory.pxi":1593
* reason_for_failure = "No aligned terminals"
* met_constraints = 0
* if self.require_aligned_chunks and num_aligned_chunks < num_chunks: # <<<<<<<<<<<<<<
* reason_for_failure = "Unaligned chunk"
* met_constraints = 0
*/
- if ((__pyx_v_self->require_aligned_chunks != 0)) {
- __pyx_t_10 = ((__pyx_v_num_aligned_chunks < __pyx_v_num_chunks) != 0);
- __pyx_t_8 = __pyx_t_10;
+ __pyx_t_10 = (__pyx_v_self->require_aligned_chunks != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L37_next_and;
} else {
- __pyx_t_8 = (__pyx_v_self->require_aligned_chunks != 0);
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L36_bool_binop_done;
}
- if (__pyx_t_8) {
+ __pyx_L37_next_and:;
+ __pyx_t_10 = ((__pyx_v_num_aligned_chunks < __pyx_v_num_chunks) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L36_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1582
+ /* "cdec/sa/rulefactory.pxi":1594
* met_constraints = 0
* if self.require_aligned_chunks and num_aligned_chunks < num_chunks:
* reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<<
@@ -57939,7 +61639,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s_Unaligned_chunk);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Unaligned_chunk);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1583
+ /* "cdec/sa/rulefactory.pxi":1595
* if self.require_aligned_chunks and num_aligned_chunks < num_chunks:
* reason_for_failure = "Unaligned chunk"
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -57947,49 +61647,54 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if met_constraints and self.tight_phrases:
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L27;
+ goto __pyx_L35;
}
- __pyx_L27:;
- goto __pyx_L20;
+ __pyx_L35:;
+ goto __pyx_L28;
}
- __pyx_L20:;
+ __pyx_L28:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1585
+ /* "cdec/sa/rulefactory.pxi":1597
* met_constraints = 0
*
* if met_constraints and self.tight_phrases: # <<<<<<<<<<<<<<
* # outside edge constraints are checked later
* for i from 0 <= i < num_chunks-1:
*/
- if ((__pyx_v_met_constraints != 0)) {
- __pyx_t_8 = __pyx_v_self->tight_phrases;
- __pyx_t_10 = __pyx_t_8;
+ __pyx_t_10 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L40_next_and;
} else {
- __pyx_t_10 = (__pyx_v_met_constraints != 0);
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L39_bool_binop_done;
}
- if (__pyx_t_10) {
+ __pyx_L40_next_and:;
+ __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L39_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1587
+ /* "cdec/sa/rulefactory.pxi":1599
* if met_constraints and self.tight_phrases:
* # outside edge constraints are checked later
* for i from 0 <= i < num_chunks-1: # <<<<<<<<<<<<<<
* if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases"
*/
- __pyx_t_12 = (__pyx_v_num_chunks - 1);
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {
+ __pyx_t_11 = (__pyx_v_num_chunks - 1);
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1588
+ /* "cdec/sa/rulefactory.pxi":1600
* # outside edge constraints are checked later
* for i from 0 <= i < num_chunks-1:
* if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1: # <<<<<<<<<<<<<<
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0
*/
- __pyx_t_10 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + (__pyx_v_chunklen[__pyx_v_i])) - __pyx_v_f_sent_start)]) == -1) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + (__pyx_v_chunklen[__pyx_v_i])) - __pyx_v_f_sent_start)]) == -1) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1589
+ /* "cdec/sa/rulefactory.pxi":1601
* for i from 0 <= i < num_chunks-1:
* if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases" # <<<<<<<<<<<<<<
@@ -57999,7 +61704,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s_Gaps_are_not_tight_phrases);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Gaps_are_not_tight_phrases);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1590
+ /* "cdec/sa/rulefactory.pxi":1602
* if f_links_low[matching.arr[matching.start+i]+chunklen[i]-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -58008,27 +61713,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1591
+ /* "cdec/sa/rulefactory.pxi":1603
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0
* break # <<<<<<<<<<<<<<
* if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases"
*/
- goto __pyx_L30_break;
+ goto __pyx_L42_break;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1592
+ /* "cdec/sa/rulefactory.pxi":1604
* met_constraints = 0
* break
* if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: # <<<<<<<<<<<<<<
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0
*/
- __pyx_t_10 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - 1) - __pyx_v_f_sent_start)]) == -1) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (((__pyx_v_f_links_low[(((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - 1) - __pyx_v_f_sent_start)]) == -1) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1593
+ /* "cdec/sa/rulefactory.pxi":1605
* break
* if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases" # <<<<<<<<<<<<<<
@@ -58038,7 +61743,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s_Gaps_are_not_tight_phrases);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Gaps_are_not_tight_phrases);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1594
+ /* "cdec/sa/rulefactory.pxi":1606
* if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1:
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -58047,22 +61752,22 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1595
+ /* "cdec/sa/rulefactory.pxi":1607
* reason_for_failure = "Gaps are not tight phrases"
* met_constraints = 0
* break # <<<<<<<<<<<<<<
*
* f_low = matching.arr[matching.start] - f_sent_start
*/
- goto __pyx_L30_break;
+ goto __pyx_L42_break;
}
}
- __pyx_L30_break:;
- goto __pyx_L28;
+ __pyx_L42_break:;
+ goto __pyx_L38;
}
- __pyx_L28:;
+ __pyx_L38:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1597
+ /* "cdec/sa/rulefactory.pxi":1609
* break
*
* f_low = matching.arr[matching.start] - f_sent_start # <<<<<<<<<<<<<<
@@ -58071,7 +61776,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_low = ((__pyx_v_matching->arr[__pyx_v_matching->start]) - __pyx_v_f_sent_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1598
+ /* "cdec/sa/rulefactory.pxi":1610
*
* f_low = matching.arr[matching.start] - f_sent_start
* f_high = matching.arr[matching.start + matching.size - 1] + chunklen[num_chunks-1] - f_sent_start # <<<<<<<<<<<<<<
@@ -58080,38 +61785,38 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_high = (((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_matching->size) - 1)]) + (__pyx_v_chunklen[(__pyx_v_num_chunks - 1)])) - __pyx_v_f_sent_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1599
+ /* "cdec/sa/rulefactory.pxi":1611
* f_low = matching.arr[matching.start] - f_sent_start
* f_high = matching.arr[matching.start + matching.size - 1] + chunklen[num_chunks-1] - f_sent_start
* if met_constraints: # <<<<<<<<<<<<<<
*
* if self.find_fixpoint(f_low, f_high, f_links_low, f_links_high, e_links_low, e_links_high,
*/
- __pyx_t_10 = (__pyx_v_met_constraints != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1601
+ /* "cdec/sa/rulefactory.pxi":1613
* if met_constraints:
*
* if self.find_fixpoint(f_low, f_high, f_links_low, f_links_high, e_links_low, e_links_high, # <<<<<<<<<<<<<<
* -1, -1, &e_low, &e_high, &f_back_low, &f_back_high, f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size,
*/
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_f_high); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1605
+ /* "cdec/sa/rulefactory.pxi":1617
* self.train_max_initial_size, self.train_max_initial_size,
* self.train_min_gap_size, 0,
* self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): # <<<<<<<<<<<<<<
* gap_error = 0
* num_gaps = 0
*/
- __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_low, __pyx_t_11, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, (&__pyx_v_e_low), (&__pyx_v_e_high), (&__pyx_v_f_back_low), (&__pyx_v_f_back_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_min_gap_size, 0, ((__pyx_v_self->max_nonterminals - __pyx_v_num_chunks) + 1), 1, 1, 0, 0) != 0);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_10) {
+ __pyx_t_9 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_low, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, (&__pyx_v_e_low), (&__pyx_v_e_high), (&__pyx_v_f_back_low), (&__pyx_v_f_back_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_min_gap_size, 0, ((__pyx_v_self->max_nonterminals - __pyx_v_num_chunks) + 1), 1, 1, 0, 0) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1606
+ /* "cdec/sa/rulefactory.pxi":1618
* self.train_min_gap_size, 0,
* self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0):
* gap_error = 0 # <<<<<<<<<<<<<<
@@ -58120,7 +61825,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_error = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1607
+ /* "cdec/sa/rulefactory.pxi":1619
* self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0):
* gap_error = 0
* num_gaps = 0 # <<<<<<<<<<<<<<
@@ -58129,17 +61834,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_num_gaps = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1609
+ /* "cdec/sa/rulefactory.pxi":1621
* num_gaps = 0
*
* if f_back_low < f_low: # <<<<<<<<<<<<<<
* f_gap_low[0] = f_back_low
* f_gap_high[0] = f_low
*/
- __pyx_t_10 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1610
+ /* "cdec/sa/rulefactory.pxi":1622
*
* if f_back_low < f_low:
* f_gap_low[0] = f_back_low # <<<<<<<<<<<<<<
@@ -58148,7 +61853,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1611
+ /* "cdec/sa/rulefactory.pxi":1623
* if f_back_low < f_low:
* f_gap_low[0] = f_back_low
* f_gap_high[0] = f_low # <<<<<<<<<<<<<<
@@ -58157,7 +61862,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_high[0]) = __pyx_v_f_low;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1612
+ /* "cdec/sa/rulefactory.pxi":1624
* f_gap_low[0] = f_back_low
* f_gap_high[0] = f_low
* num_gaps = 1 # <<<<<<<<<<<<<<
@@ -58166,7 +61871,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_num_gaps = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1613
+ /* "cdec/sa/rulefactory.pxi":1625
* f_gap_high[0] = f_low
* num_gaps = 1
* gap_start = 0 # <<<<<<<<<<<<<<
@@ -58175,7 +61880,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_start = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1614
+ /* "cdec/sa/rulefactory.pxi":1626
* num_gaps = 1
* gap_start = 0
* phrase_len = phrase_len+1 # <<<<<<<<<<<<<<
@@ -58184,17 +61889,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_phrase_len = (__pyx_v_phrase_len + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1615
+ /* "cdec/sa/rulefactory.pxi":1627
* gap_start = 0
* phrase_len = phrase_len+1
* if phrase_len > self.max_length: # <<<<<<<<<<<<<<
* gap_error = 1
* if self.tight_phrases:
*/
- __pyx_t_10 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1616
+ /* "cdec/sa/rulefactory.pxi":1628
* phrase_len = phrase_len+1
* if phrase_len > self.max_length:
* gap_error = 1 # <<<<<<<<<<<<<<
@@ -58202,21 +61907,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1:
*/
__pyx_v_gap_error = 1;
- goto __pyx_L36;
+ goto __pyx_L48;
}
- __pyx_L36:;
+ __pyx_L48:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1617
+ /* "cdec/sa/rulefactory.pxi":1629
* if phrase_len > self.max_length:
* gap_error = 1
* if self.tight_phrases: # <<<<<<<<<<<<<<
* if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1:
* gap_error = 1
*/
- __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1618
+ /* "cdec/sa/rulefactory.pxi":1630
* gap_error = 1
* if self.tight_phrases:
* if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: # <<<<<<<<<<<<<<
@@ -58225,14 +61930,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_back_low]) == -1) != 0);
if (!__pyx_t_10) {
- __pyx_t_8 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) == -1) != 0);
- __pyx_t_9 = __pyx_t_8;
+ goto __pyx_L52_next_or;
} else {
__pyx_t_9 = __pyx_t_10;
+ goto __pyx_L51_bool_binop_done;
}
+ __pyx_L52_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L51_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1619
+ /* "cdec/sa/rulefactory.pxi":1631
* if self.tight_phrases:
* if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1:
* gap_error = 1 # <<<<<<<<<<<<<<
@@ -58241,7 +61950,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_error = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1620
+ /* "cdec/sa/rulefactory.pxi":1632
* if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1:
* gap_error = 1
* reason_for_failure = "Inside edges of preceding subphrase are not tight" # <<<<<<<<<<<<<<
@@ -58250,17 +61959,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__Pyx_INCREF(__pyx_kp_s_Inside_edges_of_preceding_subphr);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Inside_edges_of_preceding_subphr);
- goto __pyx_L38;
+ goto __pyx_L50;
}
- __pyx_L38:;
- goto __pyx_L37;
+ __pyx_L50:;
+ goto __pyx_L49;
}
- __pyx_L37:;
- goto __pyx_L35;
+ __pyx_L49:;
+ goto __pyx_L47;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1622
+ /* "cdec/sa/rulefactory.pxi":1634
* reason_for_failure = "Inside edges of preceding subphrase are not tight"
* else:
* gap_start = 1 # <<<<<<<<<<<<<<
@@ -58269,22 +61978,27 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_start = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1623
+ /* "cdec/sa/rulefactory.pxi":1635
* else:
* gap_start = 1
* if self.tight_phrases and f_links_low[f_low] == -1: # <<<<<<<<<<<<<<
* # this is not a hard error. we can't extract this phrase
* # but we still might be able to extract a superphrase
*/
- if ((__pyx_v_self->tight_phrases != 0)) {
- __pyx_t_9 = (((__pyx_v_f_links_low[__pyx_v_f_low]) == -1) != 0);
- __pyx_t_10 = __pyx_t_9;
+ __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L55_next_and;
} else {
- __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L54_bool_binop_done;
}
- if (__pyx_t_10) {
+ __pyx_L55_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_low]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L54_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1626
+ /* "cdec/sa/rulefactory.pxi":1638
* # this is not a hard error. we can't extract this phrase
* # but we still might be able to extract a superphrase
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -58292,23 +62006,23 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* for i from 0 <= i < matching.size - 1:
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L39;
+ goto __pyx_L53;
}
- __pyx_L39:;
+ __pyx_L53:;
}
- __pyx_L35:;
+ __pyx_L47:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1628
+ /* "cdec/sa/rulefactory.pxi":1640
* met_constraints = 0
*
* for i from 0 <= i < matching.size - 1: # <<<<<<<<<<<<<<
* f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start
* f_gap_high[1+i] = matching.arr[matching.start+i+1] - f_sent_start
*/
- __pyx_t_12 = (__pyx_v_matching->size - 1);
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) {
+ __pyx_t_11 = (__pyx_v_matching->size - 1);
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1629
+ /* "cdec/sa/rulefactory.pxi":1641
*
* for i from 0 <= i < matching.size - 1:
* f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start # <<<<<<<<<<<<<<
@@ -58317,7 +62031,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_low[(1 + __pyx_v_i)]) = (((__pyx_v_matching->arr[(__pyx_v_matching->start + __pyx_v_i)]) + (__pyx_v_chunklen[__pyx_v_i])) - __pyx_v_f_sent_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1630
+ /* "cdec/sa/rulefactory.pxi":1642
* for i from 0 <= i < matching.size - 1:
* f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start
* f_gap_high[1+i] = matching.arr[matching.start+i+1] - f_sent_start # <<<<<<<<<<<<<<
@@ -58326,7 +62040,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_high[(1 + __pyx_v_i)]) = ((__pyx_v_matching->arr[((__pyx_v_matching->start + __pyx_v_i) + 1)]) - __pyx_v_f_sent_start);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1631
+ /* "cdec/sa/rulefactory.pxi":1643
* f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start
* f_gap_high[1+i] = matching.arr[matching.start+i+1] - f_sent_start
* num_gaps = num_gaps + 1 # <<<<<<<<<<<<<<
@@ -58336,17 +62050,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_v_num_gaps = (__pyx_v_num_gaps + 1);
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1633
+ /* "cdec/sa/rulefactory.pxi":1645
* num_gaps = num_gaps + 1
*
* if f_high < f_back_high: # <<<<<<<<<<<<<<
* f_gap_low[gap_start+num_gaps] = f_high
* f_gap_high[gap_start+num_gaps] = f_back_high
*/
- __pyx_t_10 = ((__pyx_v_f_high < __pyx_v_f_back_high) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_f_high < __pyx_v_f_back_high) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1634
+ /* "cdec/sa/rulefactory.pxi":1646
*
* if f_high < f_back_high:
* f_gap_low[gap_start+num_gaps] = f_high # <<<<<<<<<<<<<<
@@ -58355,7 +62069,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1635
+ /* "cdec/sa/rulefactory.pxi":1647
* if f_high < f_back_high:
* f_gap_low[gap_start+num_gaps] = f_high
* f_gap_high[gap_start+num_gaps] = f_back_high # <<<<<<<<<<<<<<
@@ -58364,7 +62078,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
(__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_back_high;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1636
+ /* "cdec/sa/rulefactory.pxi":1648
* f_gap_low[gap_start+num_gaps] = f_high
* f_gap_high[gap_start+num_gaps] = f_back_high
* num_gaps = num_gaps + 1 # <<<<<<<<<<<<<<
@@ -58373,7 +62087,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_num_gaps = (__pyx_v_num_gaps + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1637
+ /* "cdec/sa/rulefactory.pxi":1649
* f_gap_high[gap_start+num_gaps] = f_back_high
* num_gaps = num_gaps + 1
* phrase_len = phrase_len+1 # <<<<<<<<<<<<<<
@@ -58382,17 +62096,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_phrase_len = (__pyx_v_phrase_len + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1638
+ /* "cdec/sa/rulefactory.pxi":1650
* num_gaps = num_gaps + 1
* phrase_len = phrase_len+1
* if phrase_len > self.max_length: # <<<<<<<<<<<<<<
* gap_error = 1
* if self.tight_phrases:
*/
- __pyx_t_10 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1639
+ /* "cdec/sa/rulefactory.pxi":1651
* phrase_len = phrase_len+1
* if phrase_len > self.max_length:
* gap_error = 1 # <<<<<<<<<<<<<<
@@ -58400,21 +62114,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1:
*/
__pyx_v_gap_error = 1;
- goto __pyx_L43;
+ goto __pyx_L59;
}
- __pyx_L43:;
+ __pyx_L59:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1640
+ /* "cdec/sa/rulefactory.pxi":1652
* if phrase_len > self.max_length:
* gap_error = 1
* if self.tight_phrases: # <<<<<<<<<<<<<<
* if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1:
* gap_error = 1
*/
- __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1641
+ /* "cdec/sa/rulefactory.pxi":1653
* gap_error = 1
* if self.tight_phrases:
* if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: # <<<<<<<<<<<<<<
@@ -58423,14 +62137,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_back_high - 1)]) == -1) != 0);
if (!__pyx_t_10) {
- __pyx_t_9 = (((__pyx_v_f_links_low[__pyx_v_f_high]) == -1) != 0);
- __pyx_t_8 = __pyx_t_9;
+ goto __pyx_L63_next_or;
} else {
- __pyx_t_8 = __pyx_t_10;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L62_bool_binop_done;
}
- if (__pyx_t_8) {
+ __pyx_L63_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_high]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L62_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1642
+ /* "cdec/sa/rulefactory.pxi":1654
* if self.tight_phrases:
* if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1:
* gap_error = 1 # <<<<<<<<<<<<<<
@@ -58439,7 +62157,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_error = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1643
+ /* "cdec/sa/rulefactory.pxi":1655
* if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1:
* gap_error = 1
* reason_for_failure = "Inside edges of following subphrase are not tight" # <<<<<<<<<<<<<<
@@ -58448,32 +62166,37 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__Pyx_INCREF(__pyx_kp_s_Inside_edges_of_following_subphr);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Inside_edges_of_following_subphr);
- goto __pyx_L45;
+ goto __pyx_L61;
}
- __pyx_L45:;
- goto __pyx_L44;
+ __pyx_L61:;
+ goto __pyx_L60;
}
- __pyx_L44:;
- goto __pyx_L42;
+ __pyx_L60:;
+ goto __pyx_L58;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1645
+ /* "cdec/sa/rulefactory.pxi":1657
* reason_for_failure = "Inside edges of following subphrase are not tight"
* else:
* if self.tight_phrases and f_links_low[f_high-1] == -1: # <<<<<<<<<<<<<<
* met_constraints = 0
*
*/
- if ((__pyx_v_self->tight_phrases != 0)) {
- __pyx_t_8 = (((__pyx_v_f_links_low[(__pyx_v_f_high - 1)]) == -1) != 0);
- __pyx_t_10 = __pyx_t_8;
+ __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L66_next_and;
} else {
- __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L65_bool_binop_done;
}
- if (__pyx_t_10) {
+ __pyx_L66_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_high - 1)]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L65_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1646
+ /* "cdec/sa/rulefactory.pxi":1658
* else:
* if self.tight_phrases and f_links_low[f_high-1] == -1:
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -58481,23 +62204,23 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if gap_error == 0:
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L46;
+ goto __pyx_L64;
}
- __pyx_L46:;
+ __pyx_L64:;
}
- __pyx_L42:;
+ __pyx_L58:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1648
+ /* "cdec/sa/rulefactory.pxi":1660
* met_constraints = 0
*
* if gap_error == 0: # <<<<<<<<<<<<<<
* e_word_count = e_high - e_low
* for i from 0 <= i < num_gaps: # check integrity of subphrases
*/
- __pyx_t_10 = ((__pyx_v_gap_error == 0) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1649
+ /* "cdec/sa/rulefactory.pxi":1661
*
* if gap_error == 0:
* e_word_count = e_high - e_low # <<<<<<<<<<<<<<
@@ -58506,7 +62229,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1650
+ /* "cdec/sa/rulefactory.pxi":1662
* if gap_error == 0:
* e_word_count = e_high - e_low
* for i from 0 <= i < num_gaps: # check integrity of subphrases # <<<<<<<<<<<<<<
@@ -58516,28 +62239,28 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_num_gaps;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1651
+ /* "cdec/sa/rulefactory.pxi":1663
* e_word_count = e_high - e_low
* for i from 0 <= i < num_gaps: # check integrity of subphrases
* if self.find_fixpoint(f_gap_low[gap_start+i], f_gap_high[gap_start+i], # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* -1, -1, e_gap_low+gap_start+i, e_gap_high+gap_start+i,
*/
- __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1657
+ /* "cdec/sa/rulefactory.pxi":1669
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0) == 0: # <<<<<<<<<<<<<<
* gap_error = 1
* reason_for_failure = "Subphrase [%d, %d] failed integrity check" % (f_gap_low[gap_start+i], f_gap_high[gap_start+i])
*/
- __pyx_t_10 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)]), __pyx_t_11, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_e_gap_high + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_f_gap_low + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_f_gap_high + __pyx_v_gap_start) + __pyx_v_i), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) == 0) != 0);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_10) {
+ __pyx_t_9 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)]), __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_e_gap_high + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_f_gap_low + __pyx_v_gap_start) + __pyx_v_i), ((__pyx_v_f_gap_high + __pyx_v_gap_start) + __pyx_v_i), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) == 0) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1658
+ /* "cdec/sa/rulefactory.pxi":1670
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0) == 0:
* gap_error = 1 # <<<<<<<<<<<<<<
@@ -58546,57 +62269,57 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_gap_error = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1659
+ /* "cdec/sa/rulefactory.pxi":1671
* 0, 0, 0, 0, 0, 0, 0) == 0:
* gap_error = 1
* reason_for_failure = "Subphrase [%d, %d] failed integrity check" % (f_gap_low[gap_start+i], f_gap_high[gap_start+i]) # <<<<<<<<<<<<<<
* break
*
*/
- __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_11 = 0;
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Subphrase_d_d_failed_integrity_c, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_t_1);
- __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_4 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Subphrase_d_d_failed_integrity_c, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1660
+ /* "cdec/sa/rulefactory.pxi":1672
* gap_error = 1
* reason_for_failure = "Subphrase [%d, %d] failed integrity check" % (f_gap_low[gap_start+i], f_gap_high[gap_start+i])
* break # <<<<<<<<<<<<<<
*
* if gap_error == 0:
*/
- goto __pyx_L49_break;
+ goto __pyx_L69_break;
}
}
- __pyx_L49_break:;
- goto __pyx_L47;
+ __pyx_L69_break:;
+ goto __pyx_L67;
}
- __pyx_L47:;
+ __pyx_L67:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1662
+ /* "cdec/sa/rulefactory.pxi":1674
* break
*
* if gap_error == 0: # <<<<<<<<<<<<<<
* i = 1
* self.findexes.reset()
*/
- __pyx_t_10 = ((__pyx_v_gap_error == 0) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1663
+ /* "cdec/sa/rulefactory.pxi":1675
*
* if gap_error == 0:
* i = 1 # <<<<<<<<<<<<<<
@@ -58605,31 +62328,46 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1664
+ /* "cdec/sa/rulefactory.pxi":1676
* if gap_error == 0:
* i = 1
* self.findexes.reset() # <<<<<<<<<<<<<<
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i))
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (__pyx_t_4) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ } else {
+ __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1665
+ /* "cdec/sa/rulefactory.pxi":1677
* i = 1
* self.findexes.reset()
* if f_back_low < f_low: # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
*/
- __pyx_t_10 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1666
+ /* "cdec/sa/rulefactory.pxi":1678
* self.findexes.reset()
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -58638,7 +62376,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1667
+ /* "cdec/sa/rulefactory.pxi":1679
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1 # <<<<<<<<<<<<<<
@@ -58647,42 +62385,58 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = (__pyx_v_i + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1668
+ /* "cdec/sa/rulefactory.pxi":1680
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L52;
+ goto __pyx_L72;
}
- __pyx_L52:;
+ __pyx_L72:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1669
+ /* "cdec/sa/rulefactory.pxi":1681
* i = i+1
* self.findexes.append(sym_setindex(self.category, i))
* self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<<
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
- PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->findexes1));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
- __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ }
+ }
+ if (!__pyx_t_4) {
+ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_self->findexes1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, ((PyObject *)__pyx_v_self->findexes1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1670
+ /* "cdec/sa/rulefactory.pxi":1682
* self.findexes.append(sym_setindex(self.category, i))
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<<
@@ -58692,17 +62446,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_phrase->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1671
+ /* "cdec/sa/rulefactory.pxi":1683
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1
*/
- __pyx_t_10 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1672
+ /* "cdec/sa/rulefactory.pxi":1684
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -58711,7 +62465,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1673
+ /* "cdec/sa/rulefactory.pxi":1685
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1 # <<<<<<<<<<<<<<
@@ -58719,11 +62473,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* fphr_arr._append(phrase.syms[j])
*/
__pyx_v_i = (__pyx_v_i + 1);
- goto __pyx_L55;
+ goto __pyx_L75;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1675
+ /* "cdec/sa/rulefactory.pxi":1687
* i = i + 1
* else:
* fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<<
@@ -58732,20 +62486,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j]));
}
- __pyx_L55:;
+ __pyx_L75:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1676
+ /* "cdec/sa/rulefactory.pxi":1688
* else:
* fphr_arr._append(phrase.syms[j])
* if f_back_high > f_high: # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i))
*/
- __pyx_t_10 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1677
+ /* "cdec/sa/rulefactory.pxi":1689
* fphr_arr._append(phrase.syms[j])
* if f_back_high > f_high:
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -58754,80 +62508,80 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1678
+ /* "cdec/sa/rulefactory.pxi":1690
* if f_back_high > f_high:
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
*
* fphr = Phrase(fphr_arr)
*/
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_11); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- goto __pyx_L56;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L76;
}
- __pyx_L56:;
+ __pyx_L76:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1680
+ /* "cdec/sa/rulefactory.pxi":1692
* self.findexes.append(sym_setindex(self.category, i))
*
* fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<<
* if met_constraints:
* phrase_list = self.extract_phrases(e_low, e_high, e_gap_low + gap_start, e_gap_high + gap_start, e_links_low, num_gaps,
*/
- __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr));
- PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_fphr_arr));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fphr_arr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr));
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1681
+ /* "cdec/sa/rulefactory.pxi":1693
*
* fphr = Phrase(fphr_arr)
* if met_constraints: # <<<<<<<<<<<<<<
* phrase_list = self.extract_phrases(e_low, e_high, e_gap_low + gap_start, e_gap_high + gap_start, e_links_low, num_gaps,
* f_back_low, f_back_high, f_gap_low + gap_start, f_gap_high + gap_start, f_links_low,
*/
- __pyx_t_10 = (__pyx_v_met_constraints != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1682
+ /* "cdec/sa/rulefactory.pxi":1694
* fphr = Phrase(fphr_arr)
* if met_constraints:
* phrase_list = self.extract_phrases(e_low, e_high, e_gap_low + gap_start, e_gap_high + gap_start, e_links_low, num_gaps, # <<<<<<<<<<<<<<
* f_back_low, f_back_high, f_gap_low + gap_start, f_gap_high + gap_start, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
*/
- __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_low, __pyx_v_e_high, (__pyx_v_e_gap_low + __pyx_v_gap_start), (__pyx_v_e_gap_high + __pyx_v_gap_start), __pyx_v_e_links_low, __pyx_v_num_gaps, __pyx_v_f_back_low, __pyx_v_f_back_high, (__pyx_v_f_gap_low + __pyx_v_gap_start), (__pyx_v_f_gap_high + __pyx_v_gap_start), __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_low, __pyx_v_e_high, (__pyx_v_e_gap_low + __pyx_v_gap_start), (__pyx_v_e_gap_high + __pyx_v_gap_start), __pyx_v_e_links_low, __pyx_v_num_gaps, __pyx_v_f_back_low, __pyx_v_f_back_high, (__pyx_v_f_gap_low + __pyx_v_gap_start), (__pyx_v_f_gap_high + __pyx_v_gap_start), __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_phrase_list = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1685
+ /* "cdec/sa/rulefactory.pxi":1697
* f_back_low, f_back_high, f_gap_low + gap_start, f_gap_high + gap_start, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0: # <<<<<<<<<<<<<<
* pair_count = 1.0 / len(phrase_list)
* else:
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = ((__pyx_t_13 > 0) != 0);
- if (__pyx_t_10) {
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = ((__pyx_t_13 > 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1686
+ /* "cdec/sa/rulefactory.pxi":1698
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0:
* pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<<
* else:
* pair_count = 0
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_13 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -58836,14 +62590,14 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_pair_count = (1.0 / __pyx_t_13);
- goto __pyx_L58;
+ goto __pyx_L78;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1688
+ /* "cdec/sa/rulefactory.pxi":1700
* pair_count = 1.0 / len(phrase_list)
* else:
* pair_count = 0 # <<<<<<<<<<<<<<
@@ -58852,87 +62606,89 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_pair_count = 0.0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1689
+ /* "cdec/sa/rulefactory.pxi":1701
* else:
* pair_count = 0
* reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high) # <<<<<<<<<<<<<<
* for phrase2, eindexes in phrase_list:
* als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_f_back_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_f_back_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_f_back_high); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_e_low); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_f_back_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_e_low); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_e_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
- PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14);
- __Pyx_GIVEREF(__pyx_t_14);
+ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
__pyx_t_1 = 0;
- __pyx_t_11 = 0;
__pyx_t_3 = 0;
- __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyString_Format(__pyx_kp_s_Didn_t_extract_anything_from_d_d, __pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_t_14);
- __pyx_t_14 = 0;
+ __pyx_t_12 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Didn_t_extract_anything_from_d_d, __pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_t_4);
+ __pyx_t_4 = 0;
}
- __pyx_L58:;
+ __pyx_L78:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1690
+ /* "cdec/sa/rulefactory.pxi":1702
* pair_count = 0
* reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high)
* for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
* als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als1)))
*/
- if (PyList_CheckExact(__pyx_v_phrase_list) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
- __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0;
- __pyx_t_16 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_phrase_list)) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
+ __pyx_t_4 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
+ __pyx_t_15 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_15)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_15 = __pyx_t_16(__pyx_t_14);
- if (unlikely(!__pyx_t_15)) {
+ __pyx_t_14 = __pyx_t_15(__pyx_t_4);
+ if (unlikely(!__pyx_t_14)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_14);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
- PyObject* sequence = __pyx_t_15;
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -58941,107 +62697,115 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
}
+ __Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_11);
#else
- __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
#endif
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_1 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_17 = Py_TYPE(__pyx_t_1)->tp_iternext;
- index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L61_unpacking_failed;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_12 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_12)) goto __pyx_L81_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ index = 1; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L81_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
- index = 1; __pyx_t_11 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L61_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_17 = NULL;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L62_unpacking_done;
- __pyx_L61_unpacking_failed:;
+ goto __pyx_L82_unpacking_done;
+ __pyx_L81_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_17 = NULL;
+ __pyx_t_16 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L62_unpacking_done:;
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L82_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_12);
+ __pyx_t_12 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
__pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_11);
- __pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1691
+ /* "cdec/sa/rulefactory.pxi":1703
* reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high)
* for phrase2, eindexes in phrase_list:
* als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<<
* extracts.append((fphr, phrase2, pair_count, tuple(als1)))
* if (num_gaps < self.max_nonterminals and
*/
- __pyx_t_15 = ((PyObject *)__pyx_v_self->findexes);
- __Pyx_INCREF(__pyx_t_15);
- if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_XDECREF_SET(__pyx_v_als1, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_11));
- __pyx_t_11 = 0;
+ __pyx_t_14 = ((PyObject *)__pyx_v_self->findexes);
+ __Pyx_INCREF(__pyx_t_14);
+ if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_14), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_als1, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1692
+ /* "cdec/sa/rulefactory.pxi":1704
* for phrase2, eindexes in phrase_list:
* als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als1))) # <<<<<<<<<<<<<<
* if (num_gaps < self.max_nonterminals and
* phrase_len < self.max_length and
*/
- __pyx_t_11 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(((PyObject *)__pyx_v_als1));
- PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als1));
+ PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als1));
__Pyx_GIVEREF(((PyObject *)__pyx_v_als1));
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr));
- PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr));
+ PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr));
__Pyx_INCREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_phrase2);
+ PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_phrase2);
__Pyx_GIVEREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_11 = 0;
+ PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
__pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_15); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_14); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1702
+ * pair_count = 0
+ * reason_for_failure = "Didn't extract anything from [%d, %d] -> [%d, %d]" % (f_back_low, f_back_high, e_low, e_high)
+ * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
+ * als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
+ * extracts.append((fphr, phrase2, pair_count, tuple(als1)))
+ */
}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L57;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L77;
}
- __pyx_L57:;
+ __pyx_L77:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1693
+ /* "cdec/sa/rulefactory.pxi":1705
* als1 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als1)))
* if (num_gaps < self.max_nonterminals and # <<<<<<<<<<<<<<
@@ -59050,86 +62814,102 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_t_10 = ((__pyx_v_num_gaps < __pyx_v_self->max_nonterminals) != 0);
if (__pyx_t_10) {
+ goto __pyx_L85_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L84_bool_binop_done;
+ }
+ __pyx_L85_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1694
+ /* "cdec/sa/rulefactory.pxi":1706
* extracts.append((fphr, phrase2, pair_count, tuple(als1)))
* if (num_gaps < self.max_nonterminals and
* phrase_len < self.max_length and # <<<<<<<<<<<<<<
* f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size):
* if (f_back_low == f_low and
*/
- __pyx_t_8 = ((__pyx_v_phrase_len < __pyx_v_self->max_length) != 0);
- if (__pyx_t_8) {
+ __pyx_t_10 = ((__pyx_v_phrase_len < __pyx_v_self->max_length) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L86_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L84_bool_binop_done;
+ }
+ __pyx_L86_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1695
+ /* "cdec/sa/rulefactory.pxi":1707
* if (num_gaps < self.max_nonterminals and
* phrase_len < self.max_length and
* f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): # <<<<<<<<<<<<<<
* if (f_back_low == f_low and
* f_low >= self.train_min_gap_size and
*/
- __pyx_t_9 = ((((__pyx_v_f_back_high - __pyx_v_f_back_low) + __pyx_v_self->train_min_gap_size) <= __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_18 = __pyx_t_9;
- } else {
- __pyx_t_18 = __pyx_t_8;
- }
- __pyx_t_8 = __pyx_t_18;
- } else {
- __pyx_t_8 = __pyx_t_10;
- }
- if (__pyx_t_8) {
+ __pyx_t_10 = ((((__pyx_v_f_back_high - __pyx_v_f_back_low) + __pyx_v_self->train_min_gap_size) <= __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L84_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1696
+ /* "cdec/sa/rulefactory.pxi":1708
* phrase_len < self.max_length and
* f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size):
* if (f_back_low == f_low and # <<<<<<<<<<<<<<
* f_low >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))):
*/
- __pyx_t_8 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0);
- if (__pyx_t_8) {
+ __pyx_t_10 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L89_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L88_bool_binop_done;
+ }
+ __pyx_L89_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1697
+ /* "cdec/sa/rulefactory.pxi":1709
* f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size):
* if (f_back_low == f_low and
* f_low >= self.train_min_gap_size and # <<<<<<<<<<<<<<
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))):
* f_x_low = f_low-self.train_min_gap_size
*/
- __pyx_t_10 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_10) {
+ __pyx_t_10 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L90_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L88_bool_binop_done;
+ }
+ __pyx_L90_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1698
+ /* "cdec/sa/rulefactory.pxi":1710
* if (f_back_low == f_low and
* f_low >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))): # <<<<<<<<<<<<<<
* f_x_low = f_low-self.train_min_gap_size
* met_constraints = 1
*/
- __pyx_t_18 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
- if (!__pyx_t_18) {
- __pyx_t_9 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0);
- if (__pyx_t_9) {
- __pyx_t_19 = (((__pyx_v_f_links_low[(__pyx_v_f_back_high - 1)]) != -1) != 0);
- __pyx_t_20 = __pyx_t_19;
- } else {
- __pyx_t_20 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_20;
- } else {
- __pyx_t_9 = __pyx_t_18;
- }
- __pyx_t_18 = __pyx_t_9;
- } else {
- __pyx_t_18 = __pyx_t_10;
- }
- __pyx_t_10 = __pyx_t_18;
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L91_next_or;
} else {
- __pyx_t_10 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L88_bool_binop_done;
}
+ __pyx_L91_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0);
if (__pyx_t_10) {
+ goto __pyx_L92_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L88_bool_binop_done;
+ }
+ __pyx_L92_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_back_high - 1)]) != -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L88_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1699
+ /* "cdec/sa/rulefactory.pxi":1711
* f_low >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))):
* f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<<
@@ -59138,7 +62918,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1700
+ /* "cdec/sa/rulefactory.pxi":1712
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_back_high-1] != -1))):
* f_x_low = f_low-self.train_min_gap_size
* met_constraints = 1 # <<<<<<<<<<<<<<
@@ -59147,17 +62927,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1701
+ /* "cdec/sa/rulefactory.pxi":1713
* f_x_low = f_low-self.train_min_gap_size
* met_constraints = 1
* if self.tight_phrases: # <<<<<<<<<<<<<<
* while f_x_low >= 0 and f_links_low[f_x_low] == -1:
* f_x_low = f_x_low - 1
*/
- __pyx_t_10 = (__pyx_v_self->tight_phrases != 0);
- if (__pyx_t_10) {
+ __pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1702
+ /* "cdec/sa/rulefactory.pxi":1714
* met_constraints = 1
* if self.tight_phrases:
* while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<<
@@ -59167,14 +62947,18 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
while (1) {
__pyx_t_10 = ((__pyx_v_f_x_low >= 0) != 0);
if (__pyx_t_10) {
- __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0);
- __pyx_t_18 = __pyx_t_8;
+ goto __pyx_L97_next_and;
} else {
- __pyx_t_18 = __pyx_t_10;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L96_bool_binop_done;
}
- if (!__pyx_t_18) break;
+ __pyx_L97_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L96_bool_binop_done:;
+ if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1703
+ /* "cdec/sa/rulefactory.pxi":1715
* if self.tight_phrases:
* while f_x_low >= 0 and f_links_low[f_x_low] == -1:
* f_x_low = f_x_low - 1 # <<<<<<<<<<<<<<
@@ -59183,27 +62967,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_low = (__pyx_v_f_x_low - 1);
}
- goto __pyx_L65;
+ goto __pyx_L93;
}
- __pyx_L65:;
+ __pyx_L93:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1704
+ /* "cdec/sa/rulefactory.pxi":1716
* while f_x_low >= 0 and f_links_low[f_x_low] == -1:
* f_x_low = f_x_low - 1
* if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size: # <<<<<<<<<<<<<<
* met_constraints = 0
*
*/
- __pyx_t_18 = ((__pyx_v_f_x_low < 0) != 0);
- if (!__pyx_t_18) {
- __pyx_t_10 = (((__pyx_v_f_back_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_8 = __pyx_t_10;
+ __pyx_t_10 = ((__pyx_v_f_x_low < 0) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L100_next_or;
} else {
- __pyx_t_8 = __pyx_t_18;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L99_bool_binop_done;
}
- if (__pyx_t_8) {
+ __pyx_L100_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_back_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L99_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1705
+ /* "cdec/sa/rulefactory.pxi":1717
* f_x_low = f_x_low - 1
* if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size:
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -59211,89 +62999,100 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if (met_constraints and
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L68;
+ goto __pyx_L98;
}
- __pyx_L68:;
+ __pyx_L98:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1707
+ /* "cdec/sa/rulefactory.pxi":1719
* met_constraints = 0
*
* if (met_constraints and # <<<<<<<<<<<<<<
* (self.find_fixpoint(f_x_low, f_back_high,
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- if ((__pyx_v_met_constraints != 0)) {
+ __pyx_t_10 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L103_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L102_bool_binop_done;
+ }
+ __pyx_L103_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1708
+ /* "cdec/sa/rulefactory.pxi":1720
*
* if (met_constraints and
* (self.find_fixpoint(f_x_low, f_back_high, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_back_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1713
+ /* "cdec/sa/rulefactory.pxi":1725
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size,
* 1, 1, 1, 1, 0, 1, 0) == 1) and # <<<<<<<<<<<<<<
* ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and
* self.find_fixpoint(f_x_low, f_low, # check integrity of new subphrase
*/
- __pyx_t_8 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 1, 0, 1, 0) == 1);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (__pyx_t_8) {
+ __pyx_t_10 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 1, 0, 1, 0) == 1) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_10) {
+ goto __pyx_L104_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L102_bool_binop_done;
+ }
+ __pyx_L104_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1714
+ /* "cdec/sa/rulefactory.pxi":1726
* self.train_max_initial_size, self.train_max_initial_size,
* 1, 1, 1, 1, 0, 1, 0) == 1) and
* ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and # <<<<<<<<<<<<<<
* self.find_fixpoint(f_x_low, f_low, # check integrity of new subphrase
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- __pyx_t_18 = (!(__pyx_v_self->tight_phrases != 0));
- if (!__pyx_t_18) {
- __pyx_t_10 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1);
- __pyx_t_9 = __pyx_t_10;
- } else {
- __pyx_t_9 = __pyx_t_18;
- }
- if (__pyx_t_9) {
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L106_next_or;
+ } else {
+ goto __pyx_L105_next_and;
+ }
+ __pyx_L106_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L105_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L102_bool_binop_done;
+ }
+ __pyx_L105_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1715
+ /* "cdec/sa/rulefactory.pxi":1727
* 1, 1, 1, 1, 0, 1, 0) == 1) and
* ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and
* self.find_fixpoint(f_x_low, f_low, # check integrity of new subphrase # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_low); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1719
+ /* "cdec/sa/rulefactory.pxi":1731
* -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high,
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<<
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
*/
- __pyx_t_18 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- } else {
- __pyx_t_18 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_18;
- } else {
- __pyx_t_9 = __pyx_t_8;
- }
- __pyx_t_8 = __pyx_t_9;
- } else {
- __pyx_t_8 = (__pyx_v_met_constraints != 0);
- }
- if (__pyx_t_8) {
+ __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L102_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1721
+ /* "cdec/sa/rulefactory.pxi":1733
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear() # <<<<<<<<<<<<<<
@@ -59302,7 +63101,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1722
+ /* "cdec/sa/rulefactory.pxi":1734
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
* i = 1 # <<<<<<<<<<<<<<
@@ -59311,33 +63110,48 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1723
+ /* "cdec/sa/rulefactory.pxi":1735
* fphr_arr._clear()
* i = 1
* self.findexes.reset() # <<<<<<<<<<<<<<
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i))
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (__pyx_t_12) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1724
+ /* "cdec/sa/rulefactory.pxi":1736
* i = 1
* self.findexes.reset()
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
*/
- __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1725
+ /* "cdec/sa/rulefactory.pxi":1737
* self.findexes.reset()
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -59346,7 +63160,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1726
+ /* "cdec/sa/rulefactory.pxi":1738
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1 # <<<<<<<<<<<<<<
@@ -59355,27 +63169,43 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = (__pyx_v_i + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1727
+ /* "cdec/sa/rulefactory.pxi":1739
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
* self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<<
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
*/
- __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
- PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_self->findexes1));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (!__pyx_t_12) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, ((PyObject *)__pyx_v_self->findexes1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_self->findexes1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1728
+ /* "cdec/sa/rulefactory.pxi":1740
* i = i+1
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<<
@@ -59385,17 +63215,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_phrase->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1729
+ /* "cdec/sa/rulefactory.pxi":1741
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1
*/
- __pyx_t_8 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
- if (__pyx_t_8) {
+ __pyx_t_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1730
+ /* "cdec/sa/rulefactory.pxi":1742
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -59404,7 +63234,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1731
+ /* "cdec/sa/rulefactory.pxi":1743
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1 # <<<<<<<<<<<<<<
@@ -59412,11 +63242,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* fphr_arr._append(phrase.syms[j])
*/
__pyx_v_i = (__pyx_v_i + 1);
- goto __pyx_L72;
+ goto __pyx_L109;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1733
+ /* "cdec/sa/rulefactory.pxi":1745
* i = i + 1
* else:
* fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<<
@@ -59425,20 +63255,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j]));
}
- __pyx_L72:;
+ __pyx_L109:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1734
+ /* "cdec/sa/rulefactory.pxi":1746
* else:
* fphr_arr._append(phrase.syms[j])
* if f_back_high > f_high: # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i))
*/
- __pyx_t_8 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0);
- if (__pyx_t_8) {
+ __pyx_t_9 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1735
+ /* "cdec/sa/rulefactory.pxi":1747
* fphr_arr._append(phrase.syms[j])
* if f_back_high > f_high:
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -59447,70 +63277,70 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1736
+ /* "cdec/sa/rulefactory.pxi":1748
* if f_back_high > f_high:
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+1,
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L73;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L110;
}
- __pyx_L73:;
+ __pyx_L110:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1737
+ /* "cdec/sa/rulefactory.pxi":1749
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<<
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+1,
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id,
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fphr_arr));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fphr_arr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr));
- __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14));
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1738
+ /* "cdec/sa/rulefactory.pxi":1750
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+1, # <<<<<<<<<<<<<<
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id,
* e_sent_len, e_sent_start)
*/
- __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_14);
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1741
+ /* "cdec/sa/rulefactory.pxi":1753
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low, matching.sent_id,
* e_sent_len, e_sent_start)
* if len(phrase_list) > 0: # <<<<<<<<<<<<<<
* pair_count = 1.0 / len(phrase_list)
* else:
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_8 = ((__pyx_t_13 > 0) != 0);
- if (__pyx_t_8) {
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = ((__pyx_t_13 > 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1742
+ /* "cdec/sa/rulefactory.pxi":1754
* e_sent_len, e_sent_start)
* if len(phrase_list) > 0:
* pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<<
* else:
* pair_count = 0
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_13 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -59519,14 +63349,14 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_pair_count = (1.0 / __pyx_t_13);
- goto __pyx_L74;
+ goto __pyx_L111;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1744
+ /* "cdec/sa/rulefactory.pxi":1756
* pair_count = 1.0 / len(phrase_list)
* else:
* pair_count = 0 # <<<<<<<<<<<<<<
@@ -59535,52 +63365,54 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_pair_count = 0.0;
}
- __pyx_L74:;
+ __pyx_L111:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1745
+ /* "cdec/sa/rulefactory.pxi":1757
* else:
* pair_count = 0
* for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
* als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als2)))
*/
- if (PyList_CheckExact(__pyx_v_phrase_list) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
+ if (likely(PyList_CheckExact(__pyx_v_phrase_list)) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
__pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0;
- __pyx_t_16 = NULL;
+ __pyx_t_15 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_15)) {
+ if (likely(PyList_CheckExact(__pyx_t_14))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_16(__pyx_t_14);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_4 = __pyx_t_15(__pyx_t_14);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_4);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+ PyObject* sequence = __pyx_t_4;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -59589,160 +63421,178 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_15 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_15);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_12);
#else
- __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_17 = Py_TYPE(__pyx_t_1)->tp_iternext;
- index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L77_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_15);
- index = 1; __pyx_t_11 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L77_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_17 = NULL;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L114_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 1; __pyx_t_12 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_12)) goto __pyx_L114_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L78_unpacking_done;
- __pyx_L77_unpacking_failed:;
+ goto __pyx_L115_unpacking_done;
+ __pyx_L114_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_17 = NULL;
+ __pyx_t_16 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L78_unpacking_done:;
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L115_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_15);
- __pyx_t_15 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1746
+ /* "cdec/sa/rulefactory.pxi":1758
* pair_count = 0
* for phrase2, eindexes in phrase_list:
* als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<<
* extracts.append((fphr, phrase2, pair_count, tuple(als2)))
*
*/
- __pyx_t_3 = ((PyObject *)__pyx_v_self->findexes);
- __Pyx_INCREF(__pyx_t_3);
- if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_als2, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_11));
- __pyx_t_11 = 0;
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->findexes);
+ __Pyx_INCREF(__pyx_t_4);
+ if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_als2, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12));
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1747
+ /* "cdec/sa/rulefactory.pxi":1759
* for phrase2, eindexes in phrase_list:
* als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als2))) # <<<<<<<<<<<<<<
*
* if (f_back_high == f_high and
*/
- __pyx_t_11 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_als2));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_als2));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_als2));
__Pyx_GIVEREF(((PyObject *)__pyx_v_als2));
- __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fphr));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fphr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr));
__Pyx_INCREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_phrase2);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_phrase2);
__Pyx_GIVEREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_15);
- __Pyx_GIVEREF(__pyx_t_15);
- __pyx_t_11 = 0;
- __pyx_t_15 = 0;
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_12 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1757
+ * else:
+ * pair_count = 0
+ * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
+ * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
+ * extracts.append((fphr, phrase2, pair_count, tuple(als2)))
+ */
}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L69;
+ goto __pyx_L101;
}
- __pyx_L69:;
- goto __pyx_L64;
+ __pyx_L101:;
+ goto __pyx_L87;
}
- __pyx_L64:;
+ __pyx_L87:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1749
+ /* "cdec/sa/rulefactory.pxi":1761
* extracts.append((fphr, phrase2, pair_count, tuple(als2)))
*
* if (f_back_high == f_high and # <<<<<<<<<<<<<<
* f_sent_len - f_high >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))):
*/
- __pyx_t_8 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0);
- if (__pyx_t_8) {
+ __pyx_t_10 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L118_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L117_bool_binop_done;
+ }
+ __pyx_L118_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1750
+ /* "cdec/sa/rulefactory.pxi":1762
*
* if (f_back_high == f_high and
* f_sent_len - f_high >= self.train_min_gap_size and # <<<<<<<<<<<<<<
* ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))):
* f_x_high = f_high+self.train_min_gap_size
*/
- __pyx_t_9 = (((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_9) {
+ __pyx_t_10 = (((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L119_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L117_bool_binop_done;
+ }
+ __pyx_L119_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1751
+ /* "cdec/sa/rulefactory.pxi":1763
* if (f_back_high == f_high and
* f_sent_len - f_high >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))): # <<<<<<<<<<<<<<
* f_x_high = f_high+self.train_min_gap_size
* met_constraints = 1
*/
- __pyx_t_18 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
- if (!__pyx_t_18) {
- __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0);
- if (__pyx_t_10) {
- __pyx_t_20 = (((__pyx_v_f_links_low[__pyx_v_f_back_low]) != -1) != 0);
- __pyx_t_19 = __pyx_t_20;
- } else {
- __pyx_t_19 = __pyx_t_10;
- }
- __pyx_t_10 = __pyx_t_19;
- } else {
- __pyx_t_10 = __pyx_t_18;
- }
- __pyx_t_18 = __pyx_t_10;
- } else {
- __pyx_t_18 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_18;
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L120_next_or;
} else {
- __pyx_t_9 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L117_bool_binop_done;
+ }
+ __pyx_L120_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L121_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L117_bool_binop_done;
}
+ __pyx_L121_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_back_low]) != -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L117_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1752
+ /* "cdec/sa/rulefactory.pxi":1764
* f_sent_len - f_high >= self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))):
* f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<<
@@ -59751,7 +63601,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1753
+ /* "cdec/sa/rulefactory.pxi":1765
* ((not self.tight_phrases) or (f_links_low[f_high] != -1 and f_links_low[f_back_low] != -1))):
* f_x_high = f_high+self.train_min_gap_size
* met_constraints = 1 # <<<<<<<<<<<<<<
@@ -59760,7 +63610,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1754
+ /* "cdec/sa/rulefactory.pxi":1766
* f_x_high = f_high+self.train_min_gap_size
* met_constraints = 1
* if self.tight_phrases: # <<<<<<<<<<<<<<
@@ -59770,7 +63620,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1755
+ /* "cdec/sa/rulefactory.pxi":1767
* met_constraints = 1
* if self.tight_phrases:
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<<
@@ -59778,16 +63628,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size:
*/
while (1) {
- __pyx_t_9 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0);
- if (__pyx_t_9) {
- __pyx_t_8 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0);
- __pyx_t_18 = __pyx_t_8;
+ __pyx_t_10 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L126_next_and;
} else {
- __pyx_t_18 = __pyx_t_9;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L125_bool_binop_done;
}
- if (!__pyx_t_18) break;
+ __pyx_L126_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L125_bool_binop_done:;
+ if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1756
+ /* "cdec/sa/rulefactory.pxi":1768
* if self.tight_phrases:
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1:
* f_x_high = f_x_high + 1 # <<<<<<<<<<<<<<
@@ -59796,27 +63650,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_high = (__pyx_v_f_x_high + 1);
}
- goto __pyx_L80;
+ goto __pyx_L122;
}
- __pyx_L80:;
+ __pyx_L122:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1757
+ /* "cdec/sa/rulefactory.pxi":1769
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1:
* f_x_high = f_x_high + 1
* if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: # <<<<<<<<<<<<<<
* met_constraints = 0
*
*/
- __pyx_t_18 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0);
- if (!__pyx_t_18) {
- __pyx_t_9 = (((__pyx_v_f_x_high - __pyx_v_f_back_low) > __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_8 = __pyx_t_9;
+ __pyx_t_10 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L129_next_or;
} else {
- __pyx_t_8 = __pyx_t_18;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L128_bool_binop_done;
}
- if (__pyx_t_8) {
+ __pyx_L129_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_x_high - __pyx_v_f_back_low) > __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L128_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1758
+ /* "cdec/sa/rulefactory.pxi":1770
* f_x_high = f_x_high + 1
* if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size:
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -59824,89 +63682,100 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if (met_constraints and
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L83;
+ goto __pyx_L127;
}
- __pyx_L83:;
+ __pyx_L127:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1760
+ /* "cdec/sa/rulefactory.pxi":1772
* met_constraints = 0
*
* if (met_constraints and # <<<<<<<<<<<<<<
* self.find_fixpoint(f_back_low, f_x_high,
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- if ((__pyx_v_met_constraints != 0)) {
+ __pyx_t_10 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L132_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L131_bool_binop_done;
+ }
+ __pyx_L132_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1761
+ /* "cdec/sa/rulefactory.pxi":1773
*
* if (met_constraints and
* self.find_fixpoint(f_back_low, f_x_high, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1765
+ /* "cdec/sa/rulefactory.pxi":1777
* e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high,
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<<
* 1, 1, 1, 0, 1, 1, 0) and
* ((not self.tight_phrases) or f_links_low[f_x_high-1] != -1) and
*/
- if ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 0, 1, 1, 0) != 0)) {
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 0, 1, 1, 0) != 0);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (__pyx_t_10) {
+ goto __pyx_L133_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L131_bool_binop_done;
+ }
+ __pyx_L133_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1767
+ /* "cdec/sa/rulefactory.pxi":1779
* self.train_max_initial_size, self.train_max_initial_size,
* 1, 1, 1, 0, 1, 1, 0) and
* ((not self.tight_phrases) or f_links_low[f_x_high-1] != -1) and # <<<<<<<<<<<<<<
* self.find_fixpoint(f_high, f_x_high,
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- __pyx_t_8 = (!(__pyx_v_self->tight_phrases != 0));
- if (!__pyx_t_8) {
- __pyx_t_18 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1);
- __pyx_t_9 = __pyx_t_18;
- } else {
- __pyx_t_9 = __pyx_t_8;
- }
- if (__pyx_t_9) {
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L135_next_or;
+ } else {
+ goto __pyx_L134_next_and;
+ }
+ __pyx_L135_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L134_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L131_bool_binop_done;
+ }
+ __pyx_L134_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1768
+ /* "cdec/sa/rulefactory.pxi":1780
* 1, 1, 1, 0, 1, 1, 0) and
* ((not self.tight_phrases) or f_links_low[f_x_high-1] != -1) and
* self.find_fixpoint(f_high, f_x_high, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* -1, -1, e_gap_low+gap_start+num_gaps, e_gap_high+gap_start+num_gaps,
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1773
+ /* "cdec/sa/rulefactory.pxi":1785
* f_gap_low+gap_start+num_gaps, f_gap_high+gap_start+num_gaps,
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<<
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
*/
- __pyx_t_8 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_3, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_e_gap_high + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_f_gap_low + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_f_gap_high + __pyx_v_gap_start) + __pyx_v_num_gaps), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- } else {
- __pyx_t_8 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_8;
- } else {
- __pyx_t_9 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 1, 0, 1, 1, 0) != 0);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- }
- __pyx_t_8 = __pyx_t_9;
- } else {
- __pyx_t_8 = (__pyx_v_met_constraints != 0);
- }
- if (__pyx_t_8) {
+ __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_e_gap_high + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_f_gap_low + __pyx_v_gap_start) + __pyx_v_num_gaps), ((__pyx_v_f_gap_high + __pyx_v_gap_start) + __pyx_v_num_gaps), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L131_bool_binop_done:;
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1775
+ /* "cdec/sa/rulefactory.pxi":1787
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear() # <<<<<<<<<<<<<<
@@ -59915,7 +63784,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1776
+ /* "cdec/sa/rulefactory.pxi":1788
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
* i = 1 # <<<<<<<<<<<<<<
@@ -59924,31 +63793,46 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1777
+ /* "cdec/sa/rulefactory.pxi":1789
* fphr_arr._clear()
* i = 1
* self.findexes.reset() # <<<<<<<<<<<<<<
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i))
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (__pyx_t_3) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ } else {
+ __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1778
+ /* "cdec/sa/rulefactory.pxi":1790
* i = 1
* self.findexes.reset()
* if f_back_low < f_low: # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
*/
- __pyx_t_8 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
- if (__pyx_t_8) {
+ __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1779
+ /* "cdec/sa/rulefactory.pxi":1791
* self.findexes.reset()
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -59957,7 +63841,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1780
+ /* "cdec/sa/rulefactory.pxi":1792
* if f_back_low < f_low:
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1 # <<<<<<<<<<<<<<
@@ -59966,42 +63850,58 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = (__pyx_v_i + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1781
+ /* "cdec/sa/rulefactory.pxi":1793
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- goto __pyx_L85;
+ __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ goto __pyx_L136;
}
- __pyx_L85:;
+ __pyx_L136:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1782
+ /* "cdec/sa/rulefactory.pxi":1794
* i = i+1
* self.findexes.append(sym_setindex(self.category, i))
* self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<<
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
- PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_self->findexes1));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
- __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ }
+ }
+ if (!__pyx_t_3) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_self->findexes1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ } else {
+ __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
+ PyTuple_SET_ITEM(__pyx_t_12, 0+1, ((PyObject *)__pyx_v_self->findexes1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1783
+ /* "cdec/sa/rulefactory.pxi":1795
* self.findexes.append(sym_setindex(self.category, i))
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<<
@@ -60011,17 +63911,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_phrase->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1784
+ /* "cdec/sa/rulefactory.pxi":1796
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1
*/
- __pyx_t_8 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
- if (__pyx_t_8) {
+ __pyx_t_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1785
+ /* "cdec/sa/rulefactory.pxi":1797
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -60030,7 +63930,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1786
+ /* "cdec/sa/rulefactory.pxi":1798
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1 # <<<<<<<<<<<<<<
@@ -60038,11 +63938,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* fphr_arr._append(phrase.syms[j])
*/
__pyx_v_i = (__pyx_v_i + 1);
- goto __pyx_L88;
+ goto __pyx_L139;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1788
+ /* "cdec/sa/rulefactory.pxi":1800
* i = i + 1
* else:
* fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<<
@@ -60051,10 +63951,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j]));
}
- __pyx_L88:;
+ __pyx_L139:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1789
+ /* "cdec/sa/rulefactory.pxi":1801
* else:
* fphr_arr._append(phrase.syms[j])
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -60063,67 +63963,67 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1790
+ /* "cdec/sa/rulefactory.pxi":1802
* fphr_arr._append(phrase.syms[j])
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low+gap_start, e_gap_high+gap_start, e_links_low, num_gaps+1,
*/
- __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1791
+ /* "cdec/sa/rulefactory.pxi":1803
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<<
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low+gap_start, e_gap_high+gap_start, e_links_low, num_gaps+1,
* f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low,
*/
- __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr));
- PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr_arr));
+ PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr_arr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr));
- __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_15, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14));
- __pyx_t_14 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4));
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1792
+ /* "cdec/sa/rulefactory.pxi":1804
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low+gap_start, e_gap_high+gap_start, e_links_low, num_gaps+1, # <<<<<<<<<<<<<<
* f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
*/
- __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, (__pyx_v_e_gap_low + __pyx_v_gap_start), (__pyx_v_e_gap_high + __pyx_v_gap_start), __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, (__pyx_v_f_gap_low + __pyx_v_gap_start), (__pyx_v_f_gap_high + __pyx_v_gap_start), __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_14);
- __pyx_t_14 = 0;
+ __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, (__pyx_v_e_gap_low + __pyx_v_gap_start), (__pyx_v_e_gap_high + __pyx_v_gap_start), __pyx_v_e_links_low, (__pyx_v_num_gaps + 1), __pyx_v_f_x_low, __pyx_v_f_x_high, (__pyx_v_f_gap_low + __pyx_v_gap_start), (__pyx_v_f_gap_high + __pyx_v_gap_start), __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1795
+ /* "cdec/sa/rulefactory.pxi":1807
* f_x_low, f_x_high, f_gap_low+gap_start, f_gap_high+gap_start, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0: # <<<<<<<<<<<<<<
* pair_count = 1.0 / len(phrase_list)
* else:
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_8 = ((__pyx_t_13 > 0) != 0);
- if (__pyx_t_8) {
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = ((__pyx_t_13 > 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1796
+ /* "cdec/sa/rulefactory.pxi":1808
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0:
* pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<<
* else:
* pair_count = 0
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_13 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -60132,14 +64032,14 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_pair_count = (1.0 / __pyx_t_13);
- goto __pyx_L89;
+ goto __pyx_L140;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1798
+ /* "cdec/sa/rulefactory.pxi":1810
* pair_count = 1.0 / len(phrase_list)
* else:
* pair_count = 0 # <<<<<<<<<<<<<<
@@ -60148,52 +64048,54 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_pair_count = 0.0;
}
- __pyx_L89:;
+ __pyx_L140:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1799
+ /* "cdec/sa/rulefactory.pxi":1811
* else:
* pair_count = 0
* for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
* als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als3)))
*/
- if (PyList_CheckExact(__pyx_v_phrase_list) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
- __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0;
- __pyx_t_16 = NULL;
+ if (likely(PyList_CheckExact(__pyx_v_phrase_list)) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
+ __pyx_t_4 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
+ __pyx_t_15 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_15)) {
+ if (likely(PyList_CheckExact(__pyx_t_4))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_15 = __pyx_t_16(__pyx_t_14);
- if (unlikely(!__pyx_t_15)) {
+ __pyx_t_14 = __pyx_t_15(__pyx_t_4);
+ if (unlikely(!__pyx_t_14)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_14);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
- PyObject* sequence = __pyx_t_15;
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -60202,230 +64104,258 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
}
+ __Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_11);
#else
- __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
#endif
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_1 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_17 = Py_TYPE(__pyx_t_1)->tp_iternext;
- index = 0; __pyx_t_3 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L92_unpacking_failed;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_12 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_12)) goto __pyx_L143_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ index = 1; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L143_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
- index = 1; __pyx_t_11 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L92_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_17 = NULL;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L93_unpacking_done;
- __pyx_L92_unpacking_failed:;
+ goto __pyx_L144_unpacking_done;
+ __pyx_L143_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_17 = NULL;
+ __pyx_t_16 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L93_unpacking_done:;
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L144_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_12);
+ __pyx_t_12 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_3);
__pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_11);
- __pyx_t_11 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1800
+ /* "cdec/sa/rulefactory.pxi":1812
* pair_count = 0
* for phrase2, eindexes in phrase_list:
* als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<<
* extracts.append((fphr, phrase2, pair_count, tuple(als3)))
* if (num_gaps < self.max_nonterminals - 1 and
*/
- __pyx_t_15 = ((PyObject *)__pyx_v_self->findexes);
- __Pyx_INCREF(__pyx_t_15);
- if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __Pyx_XDECREF_SET(__pyx_v_als3, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_11));
- __pyx_t_11 = 0;
+ __pyx_t_14 = ((PyObject *)__pyx_v_self->findexes);
+ __Pyx_INCREF(__pyx_t_14);
+ if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_14), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_als3, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3));
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1801
+ /* "cdec/sa/rulefactory.pxi":1813
* for phrase2, eindexes in phrase_list:
* als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als3))) # <<<<<<<<<<<<<<
* if (num_gaps < self.max_nonterminals - 1 and
* phrase_len+1 < self.max_length and
*/
- __pyx_t_11 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(((PyObject *)__pyx_v_als3));
- PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als3));
+ PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als3));
__Pyx_GIVEREF(((PyObject *)__pyx_v_als3));
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr));
- PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr));
+ PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr));
__Pyx_INCREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_phrase2);
+ PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_phrase2);
__Pyx_GIVEREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_11 = 0;
+ PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
__pyx_t_3 = 0;
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_15); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_14); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1811
+ * else:
+ * pair_count = 0
+ * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
+ * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
+ * extracts.append((fphr, phrase2, pair_count, tuple(als3)))
+ */
}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L84;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ goto __pyx_L130;
}
- __pyx_L84:;
- goto __pyx_L79;
+ __pyx_L130:;
+ goto __pyx_L116;
}
- __pyx_L79:;
+ __pyx_L116:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1802
+ /* "cdec/sa/rulefactory.pxi":1814
* als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als3)))
* if (num_gaps < self.max_nonterminals - 1 and # <<<<<<<<<<<<<<
* phrase_len+1 < self.max_length and
* f_back_high == f_high and
*/
- __pyx_t_8 = ((__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)) != 0);
- if (__pyx_t_8) {
+ __pyx_t_10 = ((__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L147_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L147_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1803
+ /* "cdec/sa/rulefactory.pxi":1815
* extracts.append((fphr, phrase2, pair_count, tuple(als3)))
* if (num_gaps < self.max_nonterminals - 1 and
* phrase_len+1 < self.max_length and # <<<<<<<<<<<<<<
* f_back_high == f_high and
* f_back_low == f_low and
*/
- __pyx_t_9 = (((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length) != 0);
- if (__pyx_t_9) {
+ __pyx_t_10 = (((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L148_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L148_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1804
+ /* "cdec/sa/rulefactory.pxi":1816
* if (num_gaps < self.max_nonterminals - 1 and
* phrase_len+1 < self.max_length and
* f_back_high == f_high and # <<<<<<<<<<<<<<
* f_back_low == f_low and
* f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and
*/
- __pyx_t_18 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0);
- if (__pyx_t_18) {
+ __pyx_t_10 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L149_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L149_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1805
+ /* "cdec/sa/rulefactory.pxi":1817
* phrase_len+1 < self.max_length and
* f_back_high == f_high and
* f_back_low == f_low and # <<<<<<<<<<<<<<
* f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and
* f_low >= self.train_min_gap_size and
*/
- __pyx_t_10 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0);
- if (__pyx_t_10) {
+ __pyx_t_10 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L150_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L150_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1806
+ /* "cdec/sa/rulefactory.pxi":1818
* f_back_high == f_high and
* f_back_low == f_low and
* f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and # <<<<<<<<<<<<<<
* f_low >= self.train_min_gap_size and
* f_high <= f_sent_len - self.train_min_gap_size and
*/
- __pyx_t_19 = ((((__pyx_v_f_back_high - __pyx_v_f_back_low) + (2 * __pyx_v_self->train_min_gap_size)) <= __pyx_v_self->train_max_initial_size) != 0);
- if (__pyx_t_19) {
+ __pyx_t_10 = ((((__pyx_v_f_back_high - __pyx_v_f_back_low) + (2 * __pyx_v_self->train_min_gap_size)) <= __pyx_v_self->train_max_initial_size) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L151_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L151_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1807
+ /* "cdec/sa/rulefactory.pxi":1819
* f_back_low == f_low and
* f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and
* f_low >= self.train_min_gap_size and # <<<<<<<<<<<<<<
* f_high <= f_sent_len - self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))):
*/
- __pyx_t_20 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0);
- if (__pyx_t_20) {
+ __pyx_t_10 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L152_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L152_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1808
+ /* "cdec/sa/rulefactory.pxi":1820
* f_back_high - f_back_low + (2*self.train_min_gap_size) <= self.train_max_initial_size and
* f_low >= self.train_min_gap_size and
* f_high <= f_sent_len - self.train_min_gap_size and # <<<<<<<<<<<<<<
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))):
*
*/
- __pyx_t_21 = ((__pyx_v_f_high <= (__pyx_v_f_sent_len - __pyx_v_self->train_min_gap_size)) != 0);
- if (__pyx_t_21) {
+ __pyx_t_10 = ((__pyx_v_f_high <= (__pyx_v_f_sent_len - __pyx_v_self->train_min_gap_size)) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L153_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L153_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1809
+ /* "cdec/sa/rulefactory.pxi":1821
* f_low >= self.train_min_gap_size and
* f_high <= f_sent_len - self.train_min_gap_size and
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): # <<<<<<<<<<<<<<
*
* met_constraints = 1
*/
- __pyx_t_22 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
- if (!__pyx_t_22) {
- __pyx_t_23 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0);
- if (__pyx_t_23) {
- __pyx_t_24 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0);
- __pyx_t_25 = __pyx_t_24;
- } else {
- __pyx_t_25 = __pyx_t_23;
- }
- __pyx_t_23 = __pyx_t_25;
- } else {
- __pyx_t_23 = __pyx_t_22;
- }
- __pyx_t_22 = __pyx_t_23;
- } else {
- __pyx_t_22 = __pyx_t_21;
- }
- __pyx_t_21 = __pyx_t_22;
- } else {
- __pyx_t_21 = __pyx_t_20;
- }
- __pyx_t_20 = __pyx_t_21;
- } else {
- __pyx_t_20 = __pyx_t_19;
- }
- __pyx_t_19 = __pyx_t_20;
- } else {
- __pyx_t_19 = __pyx_t_10;
- }
- __pyx_t_10 = __pyx_t_19;
- } else {
- __pyx_t_10 = __pyx_t_18;
- }
- __pyx_t_18 = __pyx_t_10;
- } else {
- __pyx_t_18 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_18;
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L154_next_or;
} else {
- __pyx_t_9 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
}
+ __pyx_L154_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L155_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L146_bool_binop_done;
+ }
+ __pyx_L155_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L146_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1811
+ /* "cdec/sa/rulefactory.pxi":1823
* ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))):
*
* met_constraints = 1 # <<<<<<<<<<<<<<
@@ -60434,7 +64364,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_met_constraints = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1812
+ /* "cdec/sa/rulefactory.pxi":1824
*
* met_constraints = 1
* f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<<
@@ -60443,7 +64373,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1813
+ /* "cdec/sa/rulefactory.pxi":1825
* met_constraints = 1
* f_x_low = f_low-self.train_min_gap_size
* if self.tight_phrases: # <<<<<<<<<<<<<<
@@ -60453,7 +64383,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1814
+ /* "cdec/sa/rulefactory.pxi":1826
* f_x_low = f_low-self.train_min_gap_size
* if self.tight_phrases:
* while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<<
@@ -60461,16 +64391,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if f_x_low < 0:
*/
while (1) {
- __pyx_t_9 = ((__pyx_v_f_x_low >= 0) != 0);
- if (__pyx_t_9) {
- __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0);
- __pyx_t_18 = __pyx_t_8;
+ __pyx_t_10 = ((__pyx_v_f_x_low >= 0) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L160_next_and;
} else {
- __pyx_t_18 = __pyx_t_9;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L159_bool_binop_done;
}
- if (!__pyx_t_18) break;
+ __pyx_L160_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L159_bool_binop_done:;
+ if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1815
+ /* "cdec/sa/rulefactory.pxi":1827
* if self.tight_phrases:
* while f_x_low >= 0 and f_links_low[f_x_low] == -1:
* f_x_low = f_x_low - 1 # <<<<<<<<<<<<<<
@@ -60479,21 +64413,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_low = (__pyx_v_f_x_low - 1);
}
- goto __pyx_L95;
+ goto __pyx_L156;
}
- __pyx_L95:;
+ __pyx_L156:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1816
+ /* "cdec/sa/rulefactory.pxi":1828
* while f_x_low >= 0 and f_links_low[f_x_low] == -1:
* f_x_low = f_x_low - 1
* if f_x_low < 0: # <<<<<<<<<<<<<<
* met_constraints = 0
*
*/
- __pyx_t_18 = ((__pyx_v_f_x_low < 0) != 0);
- if (__pyx_t_18) {
+ __pyx_t_9 = ((__pyx_v_f_x_low < 0) != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1817
+ /* "cdec/sa/rulefactory.pxi":1829
* f_x_low = f_x_low - 1
* if f_x_low < 0:
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -60501,11 +64435,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* f_x_high = f_high+self.train_min_gap_size
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L98;
+ goto __pyx_L161;
}
- __pyx_L98:;
+ __pyx_L161:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1819
+ /* "cdec/sa/rulefactory.pxi":1831
* met_constraints = 0
*
* f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<<
@@ -60514,17 +64448,17 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1820
+ /* "cdec/sa/rulefactory.pxi":1832
*
* f_x_high = f_high+self.train_min_gap_size
* if self.tight_phrases: # <<<<<<<<<<<<<<
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1:
* f_x_high = f_x_high + 1
*/
- __pyx_t_18 = (__pyx_v_self->tight_phrases != 0);
- if (__pyx_t_18) {
+ __pyx_t_9 = (__pyx_v_self->tight_phrases != 0);
+ if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1821
+ /* "cdec/sa/rulefactory.pxi":1833
* f_x_high = f_high+self.train_min_gap_size
* if self.tight_phrases:
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<<
@@ -60532,16 +64466,20 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size:
*/
while (1) {
- __pyx_t_18 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0);
- if (__pyx_t_18) {
- __pyx_t_9 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0);
- __pyx_t_8 = __pyx_t_9;
+ __pyx_t_10 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L166_next_and;
} else {
- __pyx_t_8 = __pyx_t_18;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L165_bool_binop_done;
}
- if (!__pyx_t_8) break;
+ __pyx_L166_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L165_bool_binop_done:;
+ if (!__pyx_t_9) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1822
+ /* "cdec/sa/rulefactory.pxi":1834
* if self.tight_phrases:
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1:
* f_x_high = f_x_high + 1 # <<<<<<<<<<<<<<
@@ -60550,27 +64488,31 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_f_x_high = (__pyx_v_f_x_high + 1);
}
- goto __pyx_L99;
+ goto __pyx_L162;
}
- __pyx_L99:;
+ __pyx_L162:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1823
+ /* "cdec/sa/rulefactory.pxi":1835
* while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1:
* f_x_high = f_x_high + 1
* if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size: # <<<<<<<<<<<<<<
* met_constraints = 0
*
*/
- __pyx_t_8 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0);
- if (!__pyx_t_8) {
- __pyx_t_18 = (((__pyx_v_f_x_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0);
- __pyx_t_9 = __pyx_t_18;
+ __pyx_t_10 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L169_next_or;
} else {
- __pyx_t_9 = __pyx_t_8;
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L168_bool_binop_done;
}
+ __pyx_L169_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_x_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0);
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L168_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1824
+ /* "cdec/sa/rulefactory.pxi":1836
* f_x_high = f_x_high + 1
* if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size:
* met_constraints = 0 # <<<<<<<<<<<<<<
@@ -60578,121 +64520,135 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* if (met_constraints and
*/
__pyx_v_met_constraints = 0;
- goto __pyx_L102;
+ goto __pyx_L167;
}
- __pyx_L102:;
+ __pyx_L167:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1826
+ /* "cdec/sa/rulefactory.pxi":1838
* met_constraints = 0
*
* if (met_constraints and # <<<<<<<<<<<<<<
* (self.find_fixpoint(f_x_low, f_x_high,
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- if ((__pyx_v_met_constraints != 0)) {
+ __pyx_t_10 = (__pyx_v_met_constraints != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L172_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L171_bool_binop_done;
+ }
+ __pyx_L172_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1827
+ /* "cdec/sa/rulefactory.pxi":1839
*
* if (met_constraints and
* (self.find_fixpoint(f_x_low, f_x_high, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* e_low, e_high, &e_x_low, &e_x_high, &f_x_low, &f_x_high,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1832
+ /* "cdec/sa/rulefactory.pxi":1844
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size,
* 1, 1, 2, 1, 1, 1, 1) == 1) and # <<<<<<<<<<<<<<
* ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and
* self.find_fixpoint(f_x_low, f_low,
*/
- __pyx_t_9 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 2, 1, 1, 1, 1) == 1);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (__pyx_t_9) {
+ __pyx_t_10 = ((((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, __pyx_v_e_low, __pyx_v_e_high, (&__pyx_v_e_x_low), (&__pyx_v_e_x_high), (&__pyx_v_f_x_low), (&__pyx_v_f_x_high), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 1, 1, 2, 1, 1, 1, 1) == 1) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_10) {
+ goto __pyx_L173_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L171_bool_binop_done;
+ }
+ __pyx_L173_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1833
+ /* "cdec/sa/rulefactory.pxi":1845
* self.train_max_initial_size, self.train_max_initial_size,
* 1, 1, 2, 1, 1, 1, 1) == 1) and
* ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and # <<<<<<<<<<<<<<
* self.find_fixpoint(f_x_low, f_low,
* f_links_low, f_links_high, e_links_low, e_links_high,
*/
- __pyx_t_8 = (!(__pyx_v_self->tight_phrases != 0));
- if (!__pyx_t_8) {
- __pyx_t_18 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1);
- if (__pyx_t_18) {
- __pyx_t_10 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1);
- __pyx_t_19 = __pyx_t_10;
- } else {
- __pyx_t_19 = __pyx_t_18;
- }
- __pyx_t_18 = __pyx_t_19;
- } else {
- __pyx_t_18 = __pyx_t_8;
- }
- if (__pyx_t_18) {
+ __pyx_t_10 = ((!(__pyx_v_self->tight_phrases != 0)) != 0);
+ if (!__pyx_t_10) {
+ goto __pyx_L175_next_or;
+ } else {
+ goto __pyx_L174_next_and;
+ }
+ __pyx_L175_next_or:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L176_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L171_bool_binop_done;
+ }
+ __pyx_L176_next_and:;
+ __pyx_t_10 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1) != 0);
+ if (__pyx_t_10) {
+ goto __pyx_L174_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L171_bool_binop_done;
+ }
+ __pyx_L174_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1834
+ /* "cdec/sa/rulefactory.pxi":1846
* 1, 1, 2, 1, 1, 1, 1) == 1) and
* ((not self.tight_phrases) or (f_links_low[f_x_low] != -1 and f_links_low[f_x_high-1] != -1)) and
* self.find_fixpoint(f_x_low, f_low, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_low); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1838
+ /* "cdec/sa/rulefactory.pxi":1850
* -1, -1, e_gap_low, e_gap_high, f_gap_low, f_gap_high,
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<<
* 0, 0, 0, 0, 0, 0, 0) and
* self.find_fixpoint(f_high, f_x_high,
*/
- __pyx_t_8 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (__pyx_t_8) {
+ __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (__pyx_t_10) {
+ goto __pyx_L177_next_and;
+ } else {
+ __pyx_t_9 = __pyx_t_10;
+ goto __pyx_L171_bool_binop_done;
+ }
+ __pyx_L177_next_and:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1840
+ /* "cdec/sa/rulefactory.pxi":1852
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0) and
* self.find_fixpoint(f_high, f_x_high, # <<<<<<<<<<<<<<
* f_links_low, f_links_high, e_links_low, e_links_high,
* -1, -1, e_gap_low+1+num_gaps, e_gap_high+1+num_gaps,
*/
- __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_f_x_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1845
+ /* "cdec/sa/rulefactory.pxi":1857
* f_gap_low+1+num_gaps, f_gap_high+1+num_gaps,
* f_sent_len, e_sent_len,
* self.train_max_initial_size, self.train_max_initial_size, # <<<<<<<<<<<<<<
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
*/
- __pyx_t_19 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_14, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_e_gap_high + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_high + 1) + __pyx_v_num_gaps), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_10 = __pyx_t_19;
- } else {
- __pyx_t_10 = __pyx_t_8;
- }
- __pyx_t_8 = __pyx_t_10;
- } else {
- __pyx_t_8 = __pyx_t_18;
- }
- __pyx_t_18 = __pyx_t_8;
- } else {
- __pyx_t_18 = __pyx_t_9;
- }
- __pyx_t_9 = __pyx_t_18;
- } else {
- __pyx_t_9 = (__pyx_v_met_constraints != 0);
- }
+ __pyx_t_10 = (((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_4, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_links_low, __pyx_v_e_links_high, -1, -1, ((__pyx_v_e_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_e_gap_high + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_low + 1) + __pyx_v_num_gaps), ((__pyx_v_f_gap_high + 1) + __pyx_v_num_gaps), __pyx_v_f_sent_len, __pyx_v_e_sent_len, __pyx_v_self->train_max_initial_size, __pyx_v_self->train_max_initial_size, 0, 0, 0, 0, 0, 0, 0) != 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_9 = __pyx_t_10;
+ __pyx_L171_bool_binop_done:;
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1847
+ /* "cdec/sa/rulefactory.pxi":1859
* self.train_max_initial_size, self.train_max_initial_size,
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear() # <<<<<<<<<<<<<<
@@ -60701,7 +64657,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1848
+ /* "cdec/sa/rulefactory.pxi":1860
* 0, 0, 0, 0, 0, 0, 0)):
* fphr_arr._clear()
* i = 1 # <<<<<<<<<<<<<<
@@ -60710,33 +64666,48 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1849
+ /* "cdec/sa/rulefactory.pxi":1861
* fphr_arr._clear()
* i = 1
* self.findexes.reset() # <<<<<<<<<<<<<<
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i))
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_reset); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (__pyx_t_12) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+ } else {
+ __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ }
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1850
+ /* "cdec/sa/rulefactory.pxi":1862
* i = 1
* self.findexes.reset()
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
*/
- __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1851
+ /* "cdec/sa/rulefactory.pxi":1863
* self.findexes.reset()
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -60745,7 +64716,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1852
+ /* "cdec/sa/rulefactory.pxi":1864
* self.findexes.append(sym_setindex(self.category, i))
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1 # <<<<<<<<<<<<<<
@@ -60754,27 +64725,43 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_i = (__pyx_v_i + 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1853
+ /* "cdec/sa/rulefactory.pxi":1865
* fphr_arr._append(sym_setindex(self.category, i))
* i = i+1
* self.findexes.extend(self.findexes1) # <<<<<<<<<<<<<<
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
*/
- __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s_extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
- PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_self->findexes1));
- __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_12 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
+ __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
+ if (likely(__pyx_t_12)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
+ __Pyx_INCREF(__pyx_t_12);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_14, function);
+ }
+ }
+ if (!__pyx_t_12) {
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_14, ((PyObject *)__pyx_v_self->findexes1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ } else {
+ __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
+ __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1));
+ PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_self->findexes1));
+ __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1));
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1854
+ /* "cdec/sa/rulefactory.pxi":1866
* i = i+1
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<<
@@ -60784,7 +64771,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_2 = __pyx_v_phrase->n;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1855
+ /* "cdec/sa/rulefactory.pxi":1867
* self.findexes.extend(self.findexes1)
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]): # <<<<<<<<<<<<<<
@@ -60794,7 +64781,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_t_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1856
+ /* "cdec/sa/rulefactory.pxi":1868
* for j from 0 <= j < phrase.n:
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -60803,7 +64790,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1857
+ /* "cdec/sa/rulefactory.pxi":1869
* if sym_isvar(phrase.syms[j]):
* fphr_arr._append(sym_setindex(self.category, i))
* i = i + 1 # <<<<<<<<<<<<<<
@@ -60811,11 +64798,11 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
* fphr_arr._append(phrase.syms[j])
*/
__pyx_v_i = (__pyx_v_i + 1);
- goto __pyx_L106;
+ goto __pyx_L180;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1859
+ /* "cdec/sa/rulefactory.pxi":1871
* i = i + 1
* else:
* fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<<
@@ -60824,10 +64811,10 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j]));
}
- __pyx_L106:;
+ __pyx_L180:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1860
+ /* "cdec/sa/rulefactory.pxi":1872
* else:
* fphr_arr._append(phrase.syms[j])
* fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
@@ -60836,67 +64823,67 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i));
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1861
+ /* "cdec/sa/rulefactory.pxi":1873
* fphr_arr._append(phrase.syms[j])
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<<
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+2,
*/
- __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_7 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_8 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1862
+ /* "cdec/sa/rulefactory.pxi":1874
* fphr_arr._append(sym_setindex(self.category, i))
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr) # <<<<<<<<<<<<<<
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+2,
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low,
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fphr_arr));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fphr_arr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr));
- __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF_SET(__pyx_v_fphr, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14));
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1863
+ /* "cdec/sa/rulefactory.pxi":1875
* self.findexes.append(sym_setindex(self.category, i))
* fphr = Phrase(fphr_arr)
* phrase_list = self.extract_phrases(e_x_low, e_x_high, e_gap_low, e_gap_high, e_links_low, num_gaps+2, # <<<<<<<<<<<<<<
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
*/
- __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 2), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->extract_phrases(__pyx_v_self, __pyx_v_e_x_low, __pyx_v_e_x_high, __pyx_v_e_gap_low, __pyx_v_e_gap_high, __pyx_v_e_links_low, (__pyx_v_num_gaps + 2), __pyx_v_f_x_low, __pyx_v_f_x_high, __pyx_v_f_gap_low, __pyx_v_f_gap_high, __pyx_v_f_links_low, __pyx_v_matching->sent_id, __pyx_v_e_sent_len, __pyx_v_e_sent_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_XDECREF_SET(__pyx_v_phrase_list, __pyx_t_14);
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1866
+ /* "cdec/sa/rulefactory.pxi":1878
* f_x_low, f_x_high, f_gap_low, f_gap_high, f_links_low,
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0: # <<<<<<<<<<<<<<
* pair_count = 1.0 / len(phrase_list)
* else:
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_9 = ((__pyx_t_13 > 0) != 0);
if (__pyx_t_9) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1867
+ /* "cdec/sa/rulefactory.pxi":1879
* matching.sent_id, e_sent_len, e_sent_start)
* if len(phrase_list) > 0:
* pair_count = 1.0 / len(phrase_list) # <<<<<<<<<<<<<<
* else:
* pair_count = 0
*/
- __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_Length(__pyx_v_phrase_list); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(__pyx_t_13 == 0)) {
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
@@ -60905,14 +64892,14 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_pair_count = (1.0 / __pyx_t_13);
- goto __pyx_L107;
+ goto __pyx_L181;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1869
+ /* "cdec/sa/rulefactory.pxi":1881
* pair_count = 1.0 / len(phrase_list)
* else:
* pair_count = 0 # <<<<<<<<<<<<<<
@@ -60921,52 +64908,54 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
__pyx_v_pair_count = 0.0;
}
- __pyx_L107:;
+ __pyx_L181:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1870
+ /* "cdec/sa/rulefactory.pxi":1882
* else:
* pair_count = 0
* for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
* als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als4)))
*/
- if (PyList_CheckExact(__pyx_v_phrase_list) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
+ if (likely(PyList_CheckExact(__pyx_v_phrase_list)) || PyTuple_CheckExact(__pyx_v_phrase_list)) {
__pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0;
- __pyx_t_16 = NULL;
+ __pyx_t_15 = NULL;
} else {
- __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
+ __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_14)) {
- if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_15)) {
+ if (likely(PyList_CheckExact(__pyx_t_14))) {
+ if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_14)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_14, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_3 = __pyx_t_16(__pyx_t_14);
- if (unlikely(!__pyx_t_3)) {
+ __pyx_t_4 = __pyx_t_15(__pyx_t_14);
+ if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GOTREF(__pyx_t_4);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
- PyObject* sequence = __pyx_t_3;
+ if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
+ PyObject* sequence = __pyx_t_4;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -60975,119 +64964,127 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
} else {
- __pyx_t_15 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_11 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_12 = PyList_GET_ITEM(sequence, 1);
}
- __Pyx_INCREF(__pyx_t_15);
- __Pyx_INCREF(__pyx_t_11);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_12);
#else
- __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
#endif
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_17 = Py_TYPE(__pyx_t_1)->tp_iternext;
- index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L110_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_15);
- index = 1; __pyx_t_11 = __pyx_t_17(__pyx_t_1); if (unlikely(!__pyx_t_11)) goto __pyx_L110_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_11);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_17 = NULL;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L184_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_3);
+ index = 1; __pyx_t_12 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_12)) goto __pyx_L184_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_12);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_16 = NULL;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L111_unpacking_done;
- __pyx_L110_unpacking_failed:;
+ goto __pyx_L185_unpacking_done;
+ __pyx_L184_unpacking_failed:;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_17 = NULL;
+ __pyx_t_16 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_L111_unpacking_done:;
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_L185_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_15);
- __pyx_t_15 = 0;
- __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_11);
- __pyx_t_11 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_phrase2, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_eindexes, __pyx_t_12);
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1871
+ /* "cdec/sa/rulefactory.pxi":1883
* pair_count = 0
* for phrase2, eindexes in phrase_list:
* als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<<
* extracts.append((fphr, phrase2, pair_count, tuple(als4)))
* else:
*/
- __pyx_t_3 = ((PyObject *)__pyx_v_self->findexes);
- __Pyx_INCREF(__pyx_t_3);
- if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_als4, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_11));
- __pyx_t_11 = 0;
+ __pyx_t_4 = ((PyObject *)__pyx_v_self->findexes);
+ __Pyx_INCREF(__pyx_t_4);
+ if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = ((PyObject *)((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_als4, ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12));
+ __pyx_t_12 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1872
+ /* "cdec/sa/rulefactory.pxi":1884
* for phrase2, eindexes in phrase_list:
* als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
* extracts.append((fphr, phrase2, pair_count, tuple(als4))) # <<<<<<<<<<<<<<
* else:
* reason_for_failure = "Unable to extract basic phrase"
*/
- __pyx_t_11 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_11);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_12);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_als4));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_als4));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_als4));
__Pyx_GIVEREF(((PyObject *)__pyx_v_als4));
- __pyx_t_15 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(((PyObject *)__pyx_v_fphr));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_fphr));
+ PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fphr));
__Pyx_GIVEREF(((PyObject *)__pyx_v_fphr));
__Pyx_INCREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_phrase2);
+ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_phrase2);
__Pyx_GIVEREF(__pyx_v_phrase2);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_11);
- __Pyx_GIVEREF(__pyx_t_11);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_15);
- __Pyx_GIVEREF(__pyx_t_15);
- __pyx_t_11 = 0;
- __pyx_t_15 = 0;
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_12);
+ __Pyx_GIVEREF(__pyx_t_12);
+ PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_12 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_extracts, __pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1882
+ * else:
+ * pair_count = 0
+ * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<<
+ * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes)
+ * extracts.append((fphr, phrase2, pair_count, tuple(als4)))
+ */
}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- goto __pyx_L103;
+ goto __pyx_L170;
}
- __pyx_L103:;
- goto __pyx_L94;
+ __pyx_L170:;
+ goto __pyx_L145;
}
- __pyx_L94:;
- goto __pyx_L63;
+ __pyx_L145:;
+ goto __pyx_L83;
}
- __pyx_L63:;
- goto __pyx_L51;
+ __pyx_L83:;
+ goto __pyx_L71;
}
- __pyx_L51:;
- goto __pyx_L34;
+ __pyx_L71:;
+ goto __pyx_L46;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1874
+ /* "cdec/sa/rulefactory.pxi":1886
* extracts.append((fphr, phrase2, pair_count, tuple(als4)))
* else:
* reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<<
@@ -61097,12 +65094,12 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__Pyx_INCREF(__pyx_kp_s_Unable_to_extract_basic_phrase);
__Pyx_DECREF_SET(__pyx_v_reason_for_failure, __pyx_kp_s_Unable_to_extract_basic_phrase);
}
- __pyx_L34:;
- goto __pyx_L33;
+ __pyx_L46:;
+ goto __pyx_L45;
}
- __pyx_L33:;
+ __pyx_L45:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1876
+ /* "cdec/sa/rulefactory.pxi":1888
* reason_for_failure = "Unable to extract basic phrase"
*
* free(sent_links) # <<<<<<<<<<<<<<
@@ -61111,7 +65108,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_sent_links);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1877
+ /* "cdec/sa/rulefactory.pxi":1889
*
* free(sent_links)
* free(f_links_low) # <<<<<<<<<<<<<<
@@ -61120,7 +65117,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_f_links_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1878
+ /* "cdec/sa/rulefactory.pxi":1890
* free(sent_links)
* free(f_links_low)
* free(f_links_high) # <<<<<<<<<<<<<<
@@ -61129,7 +65126,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_f_links_high);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1879
+ /* "cdec/sa/rulefactory.pxi":1891
* free(f_links_low)
* free(f_links_high)
* free(e_links_low) # <<<<<<<<<<<<<<
@@ -61138,7 +65135,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_e_links_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1880
+ /* "cdec/sa/rulefactory.pxi":1892
* free(f_links_high)
* free(e_links_low)
* free(e_links_high) # <<<<<<<<<<<<<<
@@ -61147,7 +65144,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_e_links_high);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1881
+ /* "cdec/sa/rulefactory.pxi":1893
* free(e_links_low)
* free(e_links_high)
* free(f_gap_low) # <<<<<<<<<<<<<<
@@ -61156,7 +65153,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_f_gap_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1882
+ /* "cdec/sa/rulefactory.pxi":1894
* free(e_links_high)
* free(f_gap_low)
* free(f_gap_high) # <<<<<<<<<<<<<<
@@ -61165,7 +65162,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_f_gap_high);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1883
+ /* "cdec/sa/rulefactory.pxi":1895
* free(f_gap_low)
* free(f_gap_high)
* free(e_gap_low) # <<<<<<<<<<<<<<
@@ -61174,7 +65171,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_e_gap_low);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1884
+ /* "cdec/sa/rulefactory.pxi":1896
* free(f_gap_high)
* free(e_gap_low)
* free(e_gap_high) # <<<<<<<<<<<<<<
@@ -61183,7 +65180,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
*/
free(__pyx_v_e_gap_high);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1886
+ /* "cdec/sa/rulefactory.pxi":1898
* free(e_gap_high)
*
* return extracts # <<<<<<<<<<<<<<
@@ -61195,21 +65192,21 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
__pyx_r = __pyx_v_extracts;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1489
+ /* "cdec/sa/rulefactory.pxi":1493
* return ret
*
* cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): # <<<<<<<<<<<<<<
- * cdef int* sent_links, *e_links_low, *e_links_high, *f_links_low, *f_links_high
- * cdef int *f_gap_low, *f_gap_high, *e_gap_low, *e_gap_high, num_gaps, gap_start
+ * cdef int *sent_links
+ * cdef int *e_links_low
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_11);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_14);
- __Pyx_XDECREF(__pyx_t_15);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -61232,7 +65229,7 @@ static PyObject *__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract(struct
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1894
+/* "cdec/sa/rulefactory.pxi":1906
* # Aggregate stats from a training instance
* # (Extract rules, update counts)
* def add_instance(self, f_words, e_words, alignment, ctx_name=None): # <<<<<<<<<<<<<<
@@ -61276,12 +65273,12 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instanc
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e_words)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alignment)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
@@ -61290,7 +65287,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instanc
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_instance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_instance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -61309,7 +65306,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instanc
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -61322,7 +65319,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instanc
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928
+/* "cdec/sa/rulefactory.pxi":1940
* # f_ i and j are current, e_ i and j are previous
* # We care _considering_ f_j, so it is not yet in counts
* def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
@@ -61332,7 +65329,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instanc
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract = {__Pyx_NAMESTR("extract"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract = {"extract", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_f_i = 0;
PyObject *__pyx_v_f_j = 0;
@@ -61376,46 +65373,46 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_bound)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_links)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nt)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 7); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 7); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 8:
if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nt_open)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 8); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 8); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
goto __pyx_L5_argtuple_error;
@@ -61442,7 +65439,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -61456,8 +65453,8 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
}
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_e_i, PyObject *__pyx_v_e_j, PyObject *__pyx_v_min_bound, PyObject *__pyx_v_wc, PyObject *__pyx_v_links, PyObject *__pyx_v_nt, PyObject *__pyx_v_nt_open) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *__pyx_cur_scope;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *__pyx_outer_scope;
PyObject *__pyx_v_link_i = NULL;
PyObject *__pyx_v_link_j = NULL;
PyObject *__pyx_v_new_e_i = NULL;
@@ -61470,13 +65467,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
PyObject *__pyx_v_old_last_nt = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- int __pyx_t_6;
- Py_ssize_t __pyx_t_7;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ int __pyx_t_7;
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_t_10;
@@ -61484,49 +65481,54 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
PyObject *(*__pyx_t_12)(PyObject *);
int __pyx_t_13;
PyObject *__pyx_t_14 = NULL;
- int __pyx_t_15;
+ PyObject *__pyx_t_15 = NULL;
+ PyObject *__pyx_t_16 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("extract", 0);
- __pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1930
+ /* "cdec/sa/rulefactory.pxi":1942
* def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open):
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: # <<<<<<<<<<<<<<
* return
* # Unaligned word
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (!__pyx_t_3) {
- __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __pyx_t_5;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (!__pyx_t_4) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_6 = __pyx_t_3;
+ __pyx_t_1 = __pyx_t_4;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_6) {
+ __pyx_L5_next_or:;
+ __pyx_t_3 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1931
+ /* "cdec/sa/rulefactory.pxi":1943
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
* return # <<<<<<<<<<<<<<
@@ -61538,149 +65540,157 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1933
+ /* "cdec/sa/rulefactory.pxi":1945
* return
* # Unaligned word
* if not al[f_j]: # <<<<<<<<<<<<<<
* # Adjacent to non-terminal: extend (non-terminal now open)
* if nt and nt[-1][2] == f_j - 1:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_3 = ((!__pyx_t_6) != 0);
- if (__pyx_t_3) {
+ if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = ((!__pyx_t_1) != 0);
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1935
+ /* "cdec/sa/rulefactory.pxi":1947
* if not al[f_j]:
* # Adjacent to non-terminal: extend (non-terminal now open)
* if nt and nt[-1][2] == f_j - 1: # <<<<<<<<<<<<<<
* nt[-1][2] += 1
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
*/
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_3) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __pyx_t_6;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ goto __pyx_L9_next_and;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_4 = __pyx_t_1;
+ goto __pyx_L8_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L9_next_and:;
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __pyx_t_1;
+ __pyx_L8_bool_binop_done:;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1936
+ /* "cdec/sa/rulefactory.pxi":1948
* # Adjacent to non-terminal: extend (non-terminal now open)
* if nt and nt[-1][2] == f_j - 1:
* nt[-1][2] += 1 # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
* nt[-1][2] -= 1
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = 2;
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = 2;
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_2, __pyx_t_6, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1937
+ /* "cdec/sa/rulefactory.pxi":1949
* if nt and nt[-1][2] == f_j - 1:
* nt[-1][2] += 1
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True) # <<<<<<<<<<<<<<
* nt[-1][2] -= 1
* # Unless non-terminal already open, always extend with word
*/
- __pyx_t_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_1, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, Py_True); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, Py_True); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1938
+ /* "cdec/sa/rulefactory.pxi":1950
* nt[-1][2] += 1
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc, links, nt, True)
* nt[-1][2] -= 1 # <<<<<<<<<<<<<<
* # Unless non-terminal already open, always extend with word
* # Make sure adding a word doesn't exceed length
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = 2;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_6, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_7 = 2;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (unlikely(__Pyx_SetItemInt(__pyx_t_2, __pyx_t_7, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L5;
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_3, __pyx_t_6, __pyx_t_5, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1941
+ /* "cdec/sa/rulefactory.pxi":1953
* # Unless non-terminal already open, always extend with word
* # Make sure adding a word doesn't exceed length
* if not nt_open and wc < self.max_length: # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False)
* return
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = (!__pyx_t_5);
- if (__pyx_t_3) {
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __pyx_t_5;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = ((!__pyx_t_1) != 0);
+ if (__pyx_t_7) {
+ goto __pyx_L12_next_and;
} else {
- __pyx_t_6 = __pyx_t_3;
+ __pyx_t_4 = __pyx_t_7;
+ goto __pyx_L11_bool_binop_done;
}
- if (__pyx_t_6) {
+ __pyx_L12_next_and:;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __pyx_t_7;
+ __pyx_L11_bool_binop_done:;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1942
+ /* "cdec/sa/rulefactory.pxi":1954
* # Make sure adding a word doesn't exceed length
* if not nt_open and wc < self.max_length:
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
* return
* # Aligned word
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_5, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_t_3, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_t_2, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L6;
+ goto __pyx_L10;
}
- __pyx_L6:;
+ __pyx_L10:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1943
+ /* "cdec/sa/rulefactory.pxi":1955
* if not nt_open and wc < self.max_length:
* extract(f_i, f_j + 1, e_i, e_j, min_bound, wc + 1, links, nt, False)
* return # <<<<<<<<<<<<<<
@@ -61692,47 +65702,47 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1945
+ /* "cdec/sa/rulefactory.pxi":1957
* return
* # Aligned word
* link_i = fe_span[f_j][0] # <<<<<<<<<<<<<<
* link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_fe_span)) { __Pyx_RaiseClosureNameError("fe_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_fe_span)) { __Pyx_RaiseClosureNameError("fe_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_fe_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_link_i = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_link_i = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1946
+ /* "cdec/sa/rulefactory.pxi":1958
* # Aligned word
* link_i = fe_span[f_j][0]
* link_j = fe_span[f_j][1] # <<<<<<<<<<<<<<
* new_e_i = min(link_i, e_i)
* new_e_j = max(link_j, e_j)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_fe_span)) { __Pyx_RaiseClosureNameError("fe_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_fe_span)) { __Pyx_RaiseClosureNameError("fe_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_fe_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f_j); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_link_j = __pyx_t_1;
- __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_link_j = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1947
+ /* "cdec/sa/rulefactory.pxi":1959
* link_i = fe_span[f_j][0]
* link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i) # <<<<<<<<<<<<<<
@@ -61740,28 +65750,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
* # Check reverse links of newly covered words to see if they violate left
*/
__Pyx_INCREF(__pyx_v_e_i);
- __pyx_t_1 = __pyx_v_e_i;
+ __pyx_t_2 = __pyx_v_e_i;
__Pyx_INCREF(__pyx_v_link_i);
- __pyx_t_2 = __pyx_v_link_i;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_v_link_i;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = __pyx_t_1;
- } else {
+ if (__pyx_t_4) {
__Pyx_INCREF(__pyx_t_2);
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_5 = __pyx_t_2;
+ } else {
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_5 = __pyx_t_3;
}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __pyx_t_4;
- __Pyx_INCREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_new_e_i = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_2 = __pyx_t_5;
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_new_e_i = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1948
+ /* "cdec/sa/rulefactory.pxi":1960
* link_j = fe_span[f_j][1]
* new_e_i = min(link_i, e_i)
* new_e_j = max(link_j, e_j) # <<<<<<<<<<<<<<
@@ -61769,28 +65779,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
* # bound (return) or extend minimum right bound for chunk
*/
__Pyx_INCREF(__pyx_v_e_j);
- __pyx_t_1 = __pyx_v_e_j;
+ __pyx_t_2 = __pyx_v_e_j;
__Pyx_INCREF(__pyx_v_link_j);
- __pyx_t_4 = __pyx_v_link_j;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __pyx_v_link_j;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_t_1;
+ if (__pyx_t_4) {
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_3 = __pyx_t_2;
} else {
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_2 = __pyx_t_4;
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_3 = __pyx_t_5;
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __pyx_t_2;
- __Pyx_INCREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_new_e_j = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_2 = __pyx_t_3;
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_new_e_j = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951
+ /* "cdec/sa/rulefactory.pxi":1963
* # Check reverse links of newly covered words to see if they violate left
* # bound (return) or extend minimum right bound for chunk
* new_min_bound = min_bound # <<<<<<<<<<<<<<
@@ -61800,57 +65810,57 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
__Pyx_INCREF(__pyx_v_min_bound);
__pyx_v_new_min_bound = __pyx_v_min_bound;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1953
+ /* "cdec/sa/rulefactory.pxi":1965
* new_min_bound = min_bound
* # First aligned word creates span
* if e_j == -1: # <<<<<<<<<<<<<<
* for i from new_e_i <= i <= new_e_j:
* if ef_span[i][0] < f_i:
*/
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_6) {
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1954
+ /* "cdec/sa/rulefactory.pxi":1966
* # First aligned word creates span
* if e_j == -1:
* for i from new_e_i <= i <= new_e_j: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 <= __pyx_t_10; __pyx_t_11++) {
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1955
+ /* "cdec/sa/rulefactory.pxi":1967
* if e_j == -1:
* for i from new_e_i <= i <= new_e_j:
* if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
* return
* new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_6) {
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1956
+ /* "cdec/sa/rulefactory.pxi":1968
* for i from new_e_i <= i <= new_e_j:
* if ef_span[i][0] < f_i:
* return # <<<<<<<<<<<<<<
@@ -61862,99 +65872,99 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957
+ /* "cdec/sa/rulefactory.pxi":1969
* if ef_span[i][0] < f_i:
* return
* new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
* # Other aligned words extend span
* else:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_INCREF(__pyx_v_new_min_bound);
- __pyx_t_1 = __pyx_v_new_min_bound;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_v_new_min_bound;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_4 = __pyx_t_2;
+ if (__pyx_t_4) {
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_5 = __pyx_t_3;
} else {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = __pyx_t_1;
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_5 = __pyx_t_2;
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __pyx_t_4;
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __pyx_t_5;
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1954
+ /* "cdec/sa/rulefactory.pxi":1966
* # First aligned word creates span
* if e_j == -1:
* for i from new_e_i <= i <= new_e_j: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_2 = 0;
- goto __pyx_L7;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L13;
}
/*else*/ {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1960
+ /* "cdec/sa/rulefactory.pxi":1972
* # Other aligned words extend span
* else:
* for i from new_e_i <= i < e_i: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_9 = __pyx_t_11; __pyx_t_9 < __pyx_t_10; __pyx_t_9++) {
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961
+ /* "cdec/sa/rulefactory.pxi":1973
* else:
* for i from new_e_i <= i < e_i:
* if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
* return
* new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_6) {
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1962
+ /* "cdec/sa/rulefactory.pxi":1974
* for i from new_e_i <= i < e_i:
* if ef_span[i][0] < f_i:
* return # <<<<<<<<<<<<<<
@@ -61966,96 +65976,96 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1963
+ /* "cdec/sa/rulefactory.pxi":1975
* if ef_span[i][0] < f_i:
* return
* new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
* for i from e_j < i <= new_e_j:
* if ef_span[i][0] < f_i:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_INCREF(__pyx_v_new_min_bound);
- __pyx_t_2 = __pyx_v_new_min_bound;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __pyx_v_new_min_bound;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_1 = __pyx_t_4;
+ if (__pyx_t_4) {
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_2 = __pyx_t_5;
} else {
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __pyx_t_2;
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = __pyx_t_3;
}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __pyx_t_2;
+ __Pyx_INCREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __pyx_t_1;
- __Pyx_INCREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1960
+ /* "cdec/sa/rulefactory.pxi":1972
* # Other aligned words extend span
* else:
* for i from new_e_i <= i < e_i: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
- __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1964
+ /* "cdec/sa/rulefactory.pxi":1976
* return
* new_min_bound = max(new_min_bound, ef_span[i][1])
* for i from e_j < i <= new_e_j: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_t_11 = __pyx_t_9+1; __pyx_t_11 <= __pyx_t_10; __pyx_t_11++) {
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
- __pyx_t_4 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
+ __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1965
+ /* "cdec/sa/rulefactory.pxi":1977
* new_min_bound = max(new_min_bound, ef_span[i][1])
* for i from e_j < i <= new_e_j:
* if ef_span[i][0] < f_i: # <<<<<<<<<<<<<<
* return
* new_min_bound = max(new_min_bound, ef_span[i][1])
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
+ __pyx_t_5 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1966
+ /* "cdec/sa/rulefactory.pxi":1978
* for i from e_j < i <= new_e_j:
* if ef_span[i][0] < f_i:
* return # <<<<<<<<<<<<<<
@@ -62067,71 +66077,71 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1967
+ /* "cdec/sa/rulefactory.pxi":1979
* if ef_span[i][0] < f_i:
* return
* new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<<
* # Extract, extend with word (unless non-terminal open)
* if not nt_open:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_ef_span)) { __Pyx_RaiseClosureNameError("ef_span"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_ef_span == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_i); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_INCREF(__pyx_v_new_min_bound);
- __pyx_t_4 = __pyx_v_new_min_bound;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __pyx_v_new_min_bound;
+ __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_t_1;
+ if (__pyx_t_4) {
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_3 = __pyx_t_2;
} else {
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_2 = __pyx_t_4;
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_3 = __pyx_t_5;
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __pyx_t_2;
- __Pyx_INCREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_t_3;
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_new_min_bound, __pyx_t_2);
+ __pyx_t_2 = 0;
+ __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1964
+ /* "cdec/sa/rulefactory.pxi":1976
* return
* new_min_bound = max(new_min_bound, ef_span[i][1])
* for i from e_j < i <= new_e_j: # <<<<<<<<<<<<<<
* if ef_span[i][0] < f_i:
* return
*/
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
+ __pyx_t_2 = 0;
}
- __pyx_L7:;
+ __pyx_L13:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1969
+ /* "cdec/sa/rulefactory.pxi":1981
* new_min_bound = max(new_min_bound, ef_span[i][1])
* # Extract, extend with word (unless non-terminal open)
* if not nt_open: # <<<<<<<<<<<<<<
* nt_collision = False
* for link in al[f_j]:
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = ((!__pyx_t_6) != 0);
- if (__pyx_t_3) {
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = ((!__pyx_t_4) != 0);
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1970
+ /* "cdec/sa/rulefactory.pxi":1982
* # Extract, extend with word (unless non-terminal open)
* if not nt_open:
* nt_collision = False # <<<<<<<<<<<<<<
@@ -62140,74 +66150,76 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
*/
__pyx_v_nt_collision = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1971
+ /* "cdec/sa/rulefactory.pxi":1983
* if not nt_open:
* nt_collision = False
* for link in al[f_j]: # <<<<<<<<<<<<<<
* if e_nt_cover[link]:
* nt_collision = True
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
- __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
+ __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
__pyx_t_12 = NULL;
} else {
- __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_12(__pyx_t_2);
- if (unlikely(!__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_12(__pyx_t_3);
+ if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1972
+ /* "cdec/sa/rulefactory.pxi":1984
* nt_collision = False
* for link in al[f_j]:
* if e_nt_cover[link]: # <<<<<<<<<<<<<<
* nt_collision = True
* # Non-terminal collisions block word extraction and extension, but
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_e_nt_cover == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_nt_cover, __pyx_v_link); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_e_nt_cover, __pyx_v_link); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1973
+ /* "cdec/sa/rulefactory.pxi":1985
* for link in al[f_j]:
* if e_nt_cover[link]:
* nt_collision = True # <<<<<<<<<<<<<<
@@ -62215,473 +66227,543 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
* # may be okay for continuing non-terminals
*/
__pyx_v_nt_collision = 1;
- goto __pyx_L20;
+ goto __pyx_L26;
}
- __pyx_L20:;
+ __pyx_L26:;
+
+ /* "cdec/sa/rulefactory.pxi":1983
+ * if not nt_open:
+ * nt_collision = False
+ * for link in al[f_j]: # <<<<<<<<<<<<<<
+ * if e_nt_cover[link]:
+ * nt_collision = True
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1976
+ /* "cdec/sa/rulefactory.pxi":1988
* # Non-terminal collisions block word extraction and extension, but
* # may be okay for continuing non-terminals
* if not nt_collision and wc < self.max_length: # <<<<<<<<<<<<<<
* plus_links = []
* for link in al[f_j]:
*/
- __pyx_t_3 = (!(__pyx_v_nt_collision != 0));
- if (__pyx_t_3) {
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __pyx_t_6;
+ __pyx_t_4 = ((!(__pyx_v_nt_collision != 0)) != 0);
+ if (__pyx_t_4) {
+ goto __pyx_L29_next_and;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_7 = __pyx_t_4;
+ goto __pyx_L28_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L29_next_and:;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __pyx_t_4;
+ __pyx_L28_bool_binop_done:;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1977
+ /* "cdec/sa/rulefactory.pxi":1989
* # may be okay for continuing non-terminals
* if not nt_collision and wc < self.max_length:
* plus_links = [] # <<<<<<<<<<<<<<
* for link in al[f_j]:
* plus_links.append((f_j, link))
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_v_plus_links = ((PyObject*)__pyx_t_1);
- __pyx_t_1 = 0;
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_v_plus_links = ((PyObject*)__pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1978
+ /* "cdec/sa/rulefactory.pxi":1990
* if not nt_collision and wc < self.max_length:
* plus_links = []
* for link in al[f_j]: # <<<<<<<<<<<<<<
* plus_links.append((f_j, link))
* cover[link] += 1
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
- __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
+ __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
__pyx_t_12 = NULL;
} else {
- __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_1 = __pyx_t_12(__pyx_t_2);
- if (unlikely(!__pyx_t_1)) {
+ __pyx_t_2 = __pyx_t_12(__pyx_t_3);
+ if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_GOTREF(__pyx_t_2);
}
- __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1);
- __pyx_t_1 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_2);
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1979
+ /* "cdec/sa/rulefactory.pxi":1991
* plus_links = []
* for link in al[f_j]:
* plus_links.append((f_j, link)) # <<<<<<<<<<<<<<
* cover[link] += 1
* links.append(plus_links)
*/
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_f_j);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_j);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_j);
__Pyx_GIVEREF(__pyx_v_f_j);
__Pyx_INCREF(__pyx_v_link);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link);
+ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link);
__Pyx_GIVEREF(__pyx_v_link);
- __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1980
+ /* "cdec/sa/rulefactory.pxi":1992
* for link in al[f_j]:
* plus_links.append((f_j, link))
* cover[link] += 1 # <<<<<<<<<<<<<<
* links.append(plus_links)
* if links and f_j >= new_min_bound:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_cover == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
__pyx_t_14 = __pyx_cur_scope->__pyx_v_cover;
__Pyx_INCREF(__pyx_v_link);
- __pyx_t_1 = __pyx_v_link;
+ __pyx_t_2 = __pyx_v_link;
if (unlikely(__pyx_t_14 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyObject_GetItem(__pyx_t_14, __pyx_t_1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyObject_GetItem(__pyx_t_14, __pyx_t_2); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (unlikely(__pyx_t_14 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_1, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_2, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1990
+ * if not nt_collision and wc < self.max_length:
+ * plus_links = []
+ * for link in al[f_j]: # <<<<<<<<<<<<<<
+ * plus_links.append((f_j, link))
+ * cover[link] += 1
+ */
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1981
+ /* "cdec/sa/rulefactory.pxi":1993
* plus_links.append((f_j, link))
* cover[link] += 1
* links.append(plus_links) # <<<<<<<<<<<<<<
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
*/
- __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_links, __pyx_v_plus_links); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_links, __pyx_v_plus_links); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1982
+ /* "cdec/sa/rulefactory.pxi":1994
* cover[link] += 1
* links.append(plus_links)
* if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_5) {
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __pyx_t_3;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_4) {
+ goto __pyx_L34_next_and;
} else {
- __pyx_t_6 = __pyx_t_5;
+ __pyx_t_7 = __pyx_t_4;
+ goto __pyx_L33_bool_binop_done;
}
- if (__pyx_t_6) {
+ __pyx_L34_next_and:;
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = __pyx_t_4;
+ __pyx_L33_bool_binop_done:;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1983
+ /* "cdec/sa/rulefactory.pxi":1995
* links.append(plus_links)
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* links.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_rules == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_1, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
__Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_6, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_6, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_8 = 0;
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = 0;
+ __pyx_t_15 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_4); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L24;
+ __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_3); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L32;
}
- __pyx_L24:;
+ __pyx_L32:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1984
+ /* "cdec/sa/rulefactory.pxi":1996
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
* links.pop()
* for link in al[f_j]:
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_1, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_3, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_2, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1985
+ /* "cdec/sa/rulefactory.pxi":1997
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* links.pop() # <<<<<<<<<<<<<<
* for link in al[f_j]:
* cover[link] -= 1
*/
- __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1986
+ /* "cdec/sa/rulefactory.pxi":1998
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* links.pop()
* for link in al[f_j]: # <<<<<<<<<<<<<<
* cover[link] -= 1
* # Try to add a word to current non-terminal (if any), extract, extend
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
- __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
+ __pyx_t_2 = __pyx_t_16; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
__pyx_t_12 = NULL;
} else {
- __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
for (;;) {
- if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_12)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_16 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_16); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_16 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_16); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_16 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_2 = __pyx_t_12(__pyx_t_1);
- if (unlikely(!__pyx_t_2)) {
+ __pyx_t_16 = __pyx_t_12(__pyx_t_2);
+ if (unlikely(!__pyx_t_16)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_t_16);
}
- __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_2);
- __pyx_t_2 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_16);
+ __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1987
+ /* "cdec/sa/rulefactory.pxi":1999
* links.pop()
* for link in al[f_j]:
* cover[link] -= 1 # <<<<<<<<<<<<<<
* # Try to add a word to current non-terminal (if any), extract, extend
* if nt and nt[-1][2] == f_j - 1:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_cover == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
__pyx_t_14 = __pyx_cur_scope->__pyx_v_cover;
__Pyx_INCREF(__pyx_v_link);
- __pyx_t_2 = __pyx_v_link;
+ __pyx_t_16 = __pyx_v_link;
if (unlikely(__pyx_t_14 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyObject_GetItem(__pyx_t_14, __pyx_t_2); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = PyObject_GetItem(__pyx_t_14, __pyx_t_16); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_15 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(__pyx_t_14 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_2, __pyx_t_8) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_16, __pyx_t_15) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1998
+ * extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
+ * links.pop()
+ * for link in al[f_j]: # <<<<<<<<<<<<<<
+ * cover[link] -= 1
+ * # Try to add a word to current non-terminal (if any), extract, extend
+ */
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L21;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L27;
}
- __pyx_L21:;
- goto __pyx_L17;
+ __pyx_L27:;
+ goto __pyx_L23;
}
- __pyx_L17:;
+ __pyx_L23:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1989
+ /* "cdec/sa/rulefactory.pxi":2001
* cover[link] -= 1
* # Try to add a word to current non-terminal (if any), extract, extend
* if nt and nt[-1][2] == f_j - 1: # <<<<<<<<<<<<<<
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:]
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_6) {
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_3 = __pyx_t_5;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_4) {
+ goto __pyx_L39_next_and;
} else {
- __pyx_t_3 = __pyx_t_6;
+ __pyx_t_7 = __pyx_t_4;
+ goto __pyx_L38_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L39_next_and:;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = PyObject_RichCompare(__pyx_t_16, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_7 = __pyx_t_4;
+ __pyx_L38_bool_binop_done:;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1991
+ /* "cdec/sa/rulefactory.pxi":2003
* if nt and nt[-1][2] == f_j - 1:
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:] # <<<<<<<<<<<<<<
* nt[-1][2] = f_j
* if link_i < nt[-1][3]:
*/
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_8, 0, 0, NULL, NULL, &__pyx_slice__67, 0, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_v_old_last_nt = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_15, 0, 0, NULL, NULL, &__pyx_slice__67, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_v_old_last_nt = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1992
+ /* "cdec/sa/rulefactory.pxi":2004
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:]
* nt[-1][2] = f_j # <<<<<<<<<<<<<<
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1):
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_v_f_j, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1993
+ /* "cdec/sa/rulefactory.pxi":2005
* old_last_nt = nt[-1][:]
* nt[-1][2] = f_j
* if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1994
+ /* "cdec/sa/rulefactory.pxi":2006
* nt[-1][2] = f_j
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1): # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
* return
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_16, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
+ __pyx_t_16 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_6 = ((!__pyx_t_3) != 0);
- if (__pyx_t_6) {
+ __pyx_t_4 = ((!__pyx_t_7) != 0);
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1995
+ /* "cdec/sa/rulefactory.pxi":2007
* if link_i < nt[-1][3]:
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
* return
* span_inc(cover, link_i, nt[-1][3] - 1)
*/
- if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1996
+ /* "cdec/sa/rulefactory.pxi":2008
* if not span_check(cover, link_i, nt[-1][3] - 1):
* nt[-1] = old_last_nt
* return # <<<<<<<<<<<<<<
@@ -62693,157 +66775,202 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1997
+ /* "cdec/sa/rulefactory.pxi":2009
* nt[-1] = old_last_nt
* return
* span_inc(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
* span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_5, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyNumber_Subtract(__pyx_t_16, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_16) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1998
+ /* "cdec/sa/rulefactory.pxi":2010
* return
* span_inc(cover, link_i, nt[-1][3] - 1)
* span_inc(e_nt_cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
* nt[-1][3] = link_i
* if link_j > nt[-1][4]:
*/
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1999
+ /* "cdec/sa/rulefactory.pxi":2011
* span_inc(cover, link_i, nt[-1][3] - 1)
* span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i # <<<<<<<<<<<<<<
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j):
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 3, __pyx_v_link_i, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L28;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L40;
}
- __pyx_L28:;
+ __pyx_L40:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2000
+ /* "cdec/sa/rulefactory.pxi":2012
* span_inc(e_nt_cover, link_i, nt[-1][3] - 1)
* nt[-1][3] = link_i
* if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_6) {
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_15, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_4) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2001
+ /* "cdec/sa/rulefactory.pxi":2013
* nt[-1][3] = link_i
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j): # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
* return
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_16, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_16);
+ __Pyx_GIVEREF(__pyx_t_16);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_16 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_3 = ((!__pyx_t_6) != 0);
- if (__pyx_t_3) {
+ __pyx_t_7 = ((!__pyx_t_4) != 0);
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2002
+ /* "cdec/sa/rulefactory.pxi":2014
* if link_j > nt[-1][4]:
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
* return
* span_inc(cover, nt[-1][4] + 1, link_j)
*/
- if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2003
+ /* "cdec/sa/rulefactory.pxi":2015
* if not span_check(cover, nt[-1][4] + 1, link_j):
* nt[-1] = old_last_nt
* return # <<<<<<<<<<<<<<
@@ -62855,454 +66982,585 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2004
+ /* "cdec/sa/rulefactory.pxi":2016
* nt[-1] = old_last_nt
* return
* span_inc(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
* span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_5, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_16 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyNumber_Add(__pyx_t_16, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_16) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2005
+ /* "cdec/sa/rulefactory.pxi":2017
* return
* span_inc(cover, nt[-1][4] + 1, link_j)
* span_inc(e_nt_cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
* nt[-1][4] = link_j
* if links and f_j >= new_min_bound:
*/
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2006
+ /* "cdec/sa/rulefactory.pxi":2018
* span_inc(cover, nt[-1][4] + 1, link_j)
* span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j # <<<<<<<<<<<<<<
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, 4, __pyx_v_link_j, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L30;
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_v_link_j, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L42;
}
- __pyx_L30:;
+ __pyx_L42:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2007
+ /* "cdec/sa/rulefactory.pxi":2019
* span_inc(e_nt_cover, nt[-1][4] + 1, link_j)
* nt[-1][4] = link_j
* if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
*/
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_3) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = __pyx_t_6;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_4) {
+ goto __pyx_L46_next_and;
} else {
- __pyx_t_5 = __pyx_t_3;
+ __pyx_t_7 = __pyx_t_4;
+ goto __pyx_L45_bool_binop_done;
}
- if (__pyx_t_5) {
+ __pyx_L46_next_and:;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __pyx_t_4;
+ __pyx_L45_bool_binop_done:;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2008
+ /* "cdec/sa/rulefactory.pxi":2020
* nt[-1][4] = link_j
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
* nt[-1] = old_last_nt
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_rules == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_16, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_16, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_16)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_16);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_16) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
__Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_6, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_2 = 0;
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_4); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L32;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L44;
}
- __pyx_L32:;
+ __pyx_L44:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2009
+ /* "cdec/sa/rulefactory.pxi":2021
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False) # <<<<<<<<<<<<<<
* nt[-1] = old_last_nt
* if link_i < nt[-1][3]:
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2010
+ /* "cdec/sa/rulefactory.pxi":2022
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
* nt[-1] = old_last_nt # <<<<<<<<<<<<<<
* if link_i < nt[-1][3]:
* span_dec(cover, link_i, nt[-1][3] - 1)
*/
- if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2011
+ /* "cdec/sa/rulefactory.pxi":2023
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc, links, nt, False)
* nt[-1] = old_last_nt
* if link_i < nt[-1][3]: # <<<<<<<<<<<<<<
* span_dec(cover, link_i, nt[-1][3] - 1)
* span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
*/
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_5) {
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_15, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2012
+ /* "cdec/sa/rulefactory.pxi":2024
* nt[-1] = old_last_nt
* if link_i < nt[-1][3]:
* span_dec(cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
* span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]:
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2013
+ /* "cdec/sa/rulefactory.pxi":2025
* if link_i < nt[-1][3]:
* span_dec(cover, link_i, nt[-1][3] - 1)
* span_dec(e_nt_cover, link_i, nt[-1][3] - 1) # <<<<<<<<<<<<<<
* if link_j > nt[-1][4]:
* span_dec(cover, nt[-1][4] + 1, link_j)
*/
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyNumber_Subtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_8 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L33;
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L47;
}
- __pyx_L33:;
+ __pyx_L47:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2014
+ /* "cdec/sa/rulefactory.pxi":2026
* span_dec(cover, link_i, nt[-1][3] - 1)
* span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]: # <<<<<<<<<<<<<<
* span_dec(cover, nt[-1][4] + 1, link_j)
* span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_5) {
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_15, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2015
+ /* "cdec/sa/rulefactory.pxi":2027
* span_dec(e_nt_cover, link_i, nt[-1][3] - 1)
* if link_j > nt[-1][4]:
* span_dec(cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
* span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
* # Try to start a new non-terminal, extract, extend
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_8);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2016
+ /* "cdec/sa/rulefactory.pxi":2028
* if link_j > nt[-1][4]:
* span_dec(cover, nt[-1][4] + 1, link_j)
* span_dec(e_nt_cover, nt[-1][4] + 1, link_j) # <<<<<<<<<<<<<<
* # Try to start a new non-terminal, extract, extend
* if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals:
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_8);
+ __Pyx_GIVEREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L34;
+ __pyx_t_8 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ goto __pyx_L48;
}
- __pyx_L34:;
- goto __pyx_L27;
+ __pyx_L48:;
+ goto __pyx_L37;
}
- __pyx_L27:;
+ __pyx_L37:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2018
+ /* "cdec/sa/rulefactory.pxi":2030
* span_dec(e_nt_cover, nt[-1][4] + 1, link_j)
* # Try to start a new non-terminal, extract, extend
* if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals: # <<<<<<<<<<<<<<
* # Check for collisions
* if not span_check(cover, link_i, link_j):
*/
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = (!__pyx_t_5);
- if (!__pyx_t_3) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_6 = __pyx_t_5;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = ((!__pyx_t_4) != 0);
+ if (!__pyx_t_1) {
+ goto __pyx_L52_next_or;
} else {
- __pyx_t_6 = __pyx_t_3;
+ goto __pyx_L51_next_and;
}
- if (__pyx_t_6) {
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_3) {
- __pyx_t_7 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_5 = (__pyx_t_7 < __pyx_cur_scope->__pyx_v_self->max_nonterminals);
- __pyx_t_15 = __pyx_t_5;
- } else {
- __pyx_t_15 = __pyx_t_3;
- }
- __pyx_t_3 = __pyx_t_15;
+ __pyx_L52_next_or:;
+ __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_15 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_15);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_15, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_15 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_15, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (__pyx_t_1) {
+ goto __pyx_L51_next_and;
} else {
- __pyx_t_3 = __pyx_t_6;
+ __pyx_t_7 = __pyx_t_1;
+ goto __pyx_L50_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L51_next_and:;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_15 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ if (__pyx_t_1) {
+ goto __pyx_L53_next_and;
+ } else {
+ __pyx_t_7 = __pyx_t_1;
+ goto __pyx_L50_bool_binop_done;
+ }
+ __pyx_L53_next_and:;
+ __pyx_t_6 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_1 = ((__pyx_t_6 < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0);
+ __pyx_t_7 = __pyx_t_1;
+ __pyx_L50_bool_binop_done:;
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2020
+ /* "cdec/sa/rulefactory.pxi":2032
* if (not nt or f_j - nt[-1][2] > 1) and wc < self.max_length and len(nt) < self.max_nonterminals:
* # Check for collisions
* if not span_check(cover, link_i, link_j): # <<<<<<<<<<<<<<
* return
* span_inc(cover, link_i, link_j)
*/
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_6 = ((!__pyx_t_3) != 0);
- if (__pyx_t_6) {
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_1 = ((!__pyx_t_7) != 0);
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2021
+ /* "cdec/sa/rulefactory.pxi":2033
* # Check for collisions
* if not span_check(cover, link_i, link_j):
* return # <<<<<<<<<<<<<<
@@ -63314,265 +67572,344 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2022
+ /* "cdec/sa/rulefactory.pxi":2034
* if not span_check(cover, link_i, link_j):
* return
* span_inc(cover, link_i, link_j) # <<<<<<<<<<<<<<
* span_inc(e_nt_cover, link_i, link_j)
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
*/
- __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2023
+ /* "cdec/sa/rulefactory.pxi":2035
* return
* span_inc(cover, link_i, link_j)
* span_inc(e_nt_cover, link_i, link_j) # <<<<<<<<<<<<<<
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
* # Require at least one word in phrase
*/
- __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_8 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2024
+ /* "cdec/sa/rulefactory.pxi":2036
* span_inc(cover, link_i, link_j)
* span_inc(e_nt_cover, link_i, link_j)
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j]) # <<<<<<<<<<<<<<
* # Require at least one word in phrase
* if links and f_j >= new_min_bound:
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_6) {
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_8 = __pyx_t_1;
- __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_1) {
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_t_15 = __pyx_t_2;
+ __pyx_t_2 = 0;
} else {
__Pyx_INCREF(__pyx_int_1);
- __pyx_t_8 = __pyx_int_1;
+ __pyx_t_15 = __pyx_int_1;
}
- __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
- __Pyx_GIVEREF(__pyx_t_8);
+ __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
+ __Pyx_GIVEREF(__pyx_t_15);
__Pyx_INCREF(__pyx_v_f_j);
- PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_f_j);
+ PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_f_j);
__Pyx_GIVEREF(__pyx_v_f_j);
__Pyx_INCREF(__pyx_v_f_j);
- PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_f_j);
+ PyList_SET_ITEM(__pyx_t_2, 2, __pyx_v_f_j);
__Pyx_GIVEREF(__pyx_v_f_j);
__Pyx_INCREF(__pyx_v_link_i);
- PyList_SET_ITEM(__pyx_t_1, 3, __pyx_v_link_i);
+ PyList_SET_ITEM(__pyx_t_2, 3, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyList_SET_ITEM(__pyx_t_1, 4, __pyx_v_link_j);
+ PyList_SET_ITEM(__pyx_t_2, 4, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_8 = 0;
- __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_nt, __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_15 = 0;
+ __pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_nt, __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2026
+ /* "cdec/sa/rulefactory.pxi":2038
* nt.append([(nt[-1][0] + 1) if nt else 1, f_j, f_j, link_i, link_j])
* # Require at least one word in phrase
* if links and f_j >= new_min_bound: # <<<<<<<<<<<<<<
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_6) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_15 = __pyx_t_3;
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_7) {
+ goto __pyx_L57_next_and;
} else {
- __pyx_t_15 = __pyx_t_6;
+ __pyx_t_1 = __pyx_t_7;
+ goto __pyx_L56_bool_binop_done;
}
- if (__pyx_t_15) {
+ __pyx_L57_next_and:;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_v_new_min_bound, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_1 = __pyx_t_7;
+ __pyx_L56_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2027
+ /* "cdec/sa/rulefactory.pxi":2039
* # Require at least one word in phrase
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* nt.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_rules == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_form_rule); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_8, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_8 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_8)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_8);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_16 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ if (__pyx_t_8) {
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f_i);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_i);
+ PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_v_f_i);
__Pyx_GIVEREF(__pyx_v_f_i);
__Pyx_INCREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_new_e_i);
+ PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_v_new_e_i);
__Pyx_GIVEREF(__pyx_v_new_e_i);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
+ PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_6, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_6, __pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_nt);
- PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt);
+ PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_6, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
__Pyx_INCREF(__pyx_v_links);
- PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links);
+ PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_6, __pyx_v_links);
__Pyx_GIVEREF(__pyx_v_links);
- __pyx_t_4 = 0;
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = 0;
+ __pyx_t_5 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_2); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L37;
+ goto __pyx_L55;
}
- __pyx_L37:;
+ __pyx_L55:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2028
+ /* "cdec/sa/rulefactory.pxi":2040
* if links and f_j >= new_min_bound:
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False) # <<<<<<<<<<<<<<
* nt.pop()
* span_dec(cover, link_i, link_j)
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_15 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_16 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_15, __pyx_v_links, __pyx_v_nt, Py_False); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2029
+ /* "cdec/sa/rulefactory.pxi":2041
* rules.add(self.form_rule(f_i, new_e_i, f_words[f_i:f_j + 1], e_words[new_e_i:new_e_j + 1], nt, links))
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* nt.pop() # <<<<<<<<<<<<<<
* span_dec(cover, link_i, link_j)
* span_dec(e_nt_cover, link_i, link_j)
*/
- __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2030
+ /* "cdec/sa/rulefactory.pxi":2042
* extract(f_i, f_j + 1, new_e_i, new_e_j, new_min_bound, wc + 1, links, nt, False)
* nt.pop()
* span_dec(cover, link_i, link_j) # <<<<<<<<<<<<<<
* span_dec(e_nt_cover, link_i, link_j)
*
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_2)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_2) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_cover);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2031
+ /* "cdec/sa/rulefactory.pxi":2043
* nt.pop()
* span_dec(cover, link_i, link_j)
* span_dec(e_nt_cover, link_i, link_j) # <<<<<<<<<<<<<<
*
* # Try to extract phrases from every f index
*/
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_span_dec); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_15);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = NULL;
+ __pyx_t_6 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_15);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_15, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ __pyx_t_2 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_8);
+ if (__pyx_t_5) {
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
- PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_e_nt_cover);
+ PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_nt_cover);
__Pyx_INCREF(__pyx_v_link_i);
- PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i);
+ PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_v_link_i);
__Pyx_GIVEREF(__pyx_v_link_i);
__Pyx_INCREF(__pyx_v_link_j);
- PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j);
+ PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_6, __pyx_v_link_j);
__Pyx_GIVEREF(__pyx_v_link_j);
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L35;
+ __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ goto __pyx_L49;
}
- __pyx_L35:;
+ __pyx_L49:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928
+ /* "cdec/sa/rulefactory.pxi":1940
* # f_ i and j are current, e_ i and j are previous
* # We care _considering_ f_j, so it is not yet in counts
* def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
@@ -63584,11 +67921,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_14);
+ __Pyx_XDECREF(__pyx_t_15);
+ __Pyx_XDECREF(__pyx_t_16);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -63606,7 +67945,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1894
+/* "cdec/sa/rulefactory.pxi":1906
* # Aggregate stats from a training instance
* # (Extract rules, update counts)
* def add_instance(self, f_words, e_words, alignment, ctx_name=None): # <<<<<<<<<<<<<<
@@ -63615,7 +67954,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instanc
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words, PyObject *__pyx_v_e_words, PyObject *__pyx_v_alignment, PyObject *__pyx_v_ctx_name) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *__pyx_cur_scope;
PyObject *__pyx_v_e_len = NULL;
PyObject *__pyx_v_f = NULL;
PyObject *__pyx_v_e = NULL;
@@ -63648,7 +67987,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("add_instance", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -63664,7 +68003,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1896
+ /* "cdec/sa/rulefactory.pxi":1908
* def add_instance(self, f_words, e_words, alignment, ctx_name=None):
*
* self.online = True # <<<<<<<<<<<<<<
@@ -63673,20 +68012,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__pyx_cur_scope->__pyx_v_self->online = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1903
+ /* "cdec/sa/rulefactory.pxi":1915
* # span more than once.
* # (f, e, al, lex_f_i, lex_f_j)
* rules = set() # <<<<<<<<<<<<<<
*
* f_len = len(f_words)
*/
- __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_rules = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1905
+ /* "cdec/sa/rulefactory.pxi":1917
* rules = set()
*
* f_len = len(f_words) # <<<<<<<<<<<<<<
@@ -63695,15 +68034,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__pyx_t_1 = __pyx_cur_scope->__pyx_v_f_words;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_f_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1906
+ /* "cdec/sa/rulefactory.pxi":1918
*
* f_len = len(f_words)
* e_len = len(e_words) # <<<<<<<<<<<<<<
@@ -63712,61 +68051,63 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__pyx_t_1 = __pyx_cur_scope->__pyx_v_e_words;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_e_len = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1909
+ /* "cdec/sa/rulefactory.pxi":1921
*
* # Pre-compute alignment info
* al = [[] for i in range(f_len)] # <<<<<<<<<<<<<<
* fe_span = [[e_len + 1, -1] for i in range(f_len)]
* ef_span = [[f_len + 1, -1] for i in range(e_len)]
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_len);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f_len);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_len);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
__pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63774,9 +68115,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
}
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -63784,54 +68125,56 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_cur_scope->__pyx_v_al = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1910
+ /* "cdec/sa/rulefactory.pxi":1922
* # Pre-compute alignment info
* al = [[] for i in range(f_len)]
* fe_span = [[e_len + 1, -1] for i in range(f_len)] # <<<<<<<<<<<<<<
* ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for f, e in alignment:
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_len);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f_len);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_len);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
__pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63839,9 +68182,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
}
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyNumber_Add(__pyx_v_e_len, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_Add(__pyx_v_e_len, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
@@ -63849,7 +68192,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
PyList_SET_ITEM(__pyx_t_6, 1, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
__pyx_t_4 = 0;
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -63857,54 +68200,56 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_cur_scope->__pyx_v_fe_span = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1911
+ /* "cdec/sa/rulefactory.pxi":1923
* al = [[] for i in range(f_len)]
* fe_span = [[e_len + 1, -1] for i in range(f_len)]
* ef_span = [[f_len + 1, -1] for i in range(e_len)] # <<<<<<<<<<<<<<
* for f, e in alignment:
* al[f].append(e)
*/
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_e_len);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_len);
__Pyx_GIVEREF(__pyx_v_e_len);
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
+ if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
__pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63912,9 +68257,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
}
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
@@ -63922,7 +68267,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
__pyx_t_6 = 0;
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -63930,43 +68275,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_cur_scope->__pyx_v_ef_span = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1912
+ /* "cdec/sa/rulefactory.pxi":1924
* fe_span = [[e_len + 1, -1] for i in range(f_len)]
* ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for f, e in alignment: # <<<<<<<<<<<<<<
* al[f].append(e)
* fe_span[f][0] = min(fe_span[f][0], e)
*/
- if (PyList_CheckExact(__pyx_v_alignment) || PyTuple_CheckExact(__pyx_v_alignment)) {
+ if (likely(PyList_CheckExact(__pyx_v_alignment)) || PyTuple_CheckExact(__pyx_v_alignment)) {
__pyx_t_1 = __pyx_v_alignment; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_3 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -63982,7 +68329,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -63995,15 +68342,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
@@ -64011,7 +68358,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L12_unpacking_done;
@@ -64019,7 +68366,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4);
@@ -64027,19 +68374,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1913
+ /* "cdec/sa/rulefactory.pxi":1925
* ef_span = [[f_len + 1, -1] for i in range(e_len)]
* for f, e in alignment:
* al[f].append(e) # <<<<<<<<<<<<<<
* fe_span[f][0] = min(fe_span[f][0], e)
* fe_span[f][1] = max(fe_span[f][1], e)
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1914
+ /* "cdec/sa/rulefactory.pxi":1926
* for f, e in alignment:
* al[f].append(e)
* fe_span[f][0] = min(fe_span[f][0], e) # <<<<<<<<<<<<<<
@@ -64048,13 +68395,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__Pyx_INCREF(__pyx_v_e);
__pyx_t_3 = __pyx_v_e;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_10) {
__Pyx_INCREF(__pyx_t_3);
@@ -64068,13 +68415,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_t_3 = __pyx_t_6;
__Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1915
+ /* "cdec/sa/rulefactory.pxi":1927
* al[f].append(e)
* fe_span[f][0] = min(fe_span[f][0], e)
* fe_span[f][1] = max(fe_span[f][1], e) # <<<<<<<<<<<<<<
@@ -64083,13 +68430,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__Pyx_INCREF(__pyx_v_e);
__pyx_t_3 = __pyx_v_e;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_10) {
__Pyx_INCREF(__pyx_t_3);
@@ -64103,13 +68450,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_t_3 = __pyx_t_6;
__Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fe_span, __pyx_v_f); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1916
+ /* "cdec/sa/rulefactory.pxi":1928
* fe_span[f][0] = min(fe_span[f][0], e)
* fe_span[f][1] = max(fe_span[f][1], e)
* ef_span[e][0] = min(ef_span[e][0], f) # <<<<<<<<<<<<<<
@@ -64118,13 +68465,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__Pyx_INCREF(__pyx_v_f);
__pyx_t_3 = __pyx_v_f;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_10) {
__Pyx_INCREF(__pyx_t_3);
@@ -64138,13 +68485,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_t_3 = __pyx_t_6;
__Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1917
+ /* "cdec/sa/rulefactory.pxi":1929
* fe_span[f][1] = max(fe_span[f][1], e)
* ef_span[e][0] = min(ef_span[e][0], f)
* ef_span[e][1] = max(ef_span[e][1], f) # <<<<<<<<<<<<<<
@@ -64153,13 +68500,13 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
*/
__Pyx_INCREF(__pyx_v_f);
__pyx_t_3 = __pyx_v_f;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_10) {
__Pyx_INCREF(__pyx_t_3);
@@ -64173,27 +68520,35 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_t_3 = __pyx_t_6;
__Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_ef_span, __pyx_v_e); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":1924
+ * fe_span = [[e_len + 1, -1] for i in range(f_len)]
+ * ef_span = [[f_len + 1, -1] for i in range(e_len)]
+ * for f, e in alignment: # <<<<<<<<<<<<<<
+ * al[f].append(e)
+ * fe_span[f][0] = min(fe_span[f][0], e)
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1920
+ /* "cdec/sa/rulefactory.pxi":1932
*
* # Target side word coverage
* cover = [0] * e_len # <<<<<<<<<<<<<<
* # Non-terminal coverage
* f_nt_cover = [0] * f_len
*/
- __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_temp;
@@ -64202,19 +68557,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_cur_scope->__pyx_v_cover = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1922
+ /* "cdec/sa/rulefactory.pxi":1934
* cover = [0] * e_len
* # Non-terminal coverage
* f_nt_cover = [0] * f_len # <<<<<<<<<<<<<<
* e_nt_cover = [0] * e_len
*
*/
- __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_f_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_cur_scope->__pyx_v_f_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_temp;
@@ -64222,19 +68577,19 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_v_f_nt_cover = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1923
+ /* "cdec/sa/rulefactory.pxi":1935
* # Non-terminal coverage
* f_nt_cover = [0] * f_len
* e_nt_cover = [0] * e_len # <<<<<<<<<<<<<<
*
* # Extract all possible hierarchical phrases starting at a source index
*/
- __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_int_0);
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_1, __pyx_v_e_len); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_temp;
@@ -64243,44 +68598,44 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_cur_scope->__pyx_v_e_nt_cover = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928
+ /* "cdec/sa/rulefactory.pxi":1940
* # f_ i and j are current, e_ i and j are previous
* # We care _considering_ f_j, so it is not yet in counts
* def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, 0, __pyx_n_s_add_instance_locals_extract, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, 0, __pyx_n_s_add_instance_locals_extract, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec_sa__sa, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_extract = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2034
+ /* "cdec/sa/rulefactory.pxi":2046
*
* # Try to extract phrases from every f index
* for f_i from 0 <= f_i < f_len: # <<<<<<<<<<<<<<
* # Skip if phrases won't be tight on left side
* if not al[f_i]:
*/
- __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_11; __pyx_v_f_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2036
+ /* "cdec/sa/rulefactory.pxi":2048
* for f_i from 0 <= f_i < f_len:
* # Skip if phrases won't be tight on left side
* if not al[f_i]: # <<<<<<<<<<<<<<
* continue
* extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False)
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_12 = ((!__pyx_t_10) != 0);
if (__pyx_t_12) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2037
+ /* "cdec/sa/rulefactory.pxi":2049
* # Skip if phrases won't be tight on left side
* if not al[f_i]:
* continue # <<<<<<<<<<<<<<
@@ -64290,26 +68645,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
goto __pyx_L13_continue;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2038
+ /* "cdec/sa/rulefactory.pxi":2050
* if not al[f_i]:
* continue
* extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False) # <<<<<<<<<<<<<<
*
* stats = self.online_stats[ctx_name]
*/
- __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_14 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_3, __pyx_t_6, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, __pyx_t_7, __pyx_t_13, Py_False); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_3, __pyx_t_6, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, __pyx_t_7, __pyx_t_13, Py_False); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -64321,74 +68676,92 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__pyx_L13_continue:;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2040
+ /* "cdec/sa/rulefactory.pxi":2052
* extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False)
*
* stats = self.online_stats[ctx_name] # <<<<<<<<<<<<<<
*
* # Update possible phrases (samples)
*/
- __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_v_ctx_name); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_14 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_v_ctx_name); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_14);
__pyx_v_stats = __pyx_t_14;
__pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2045
+ /* "cdec/sa/rulefactory.pxi":2057
* # This could be more efficiently integrated with extraction
* # at the cost of readability
* for f, lex_i, lex_j in self.get_f_phrases(f_words): # <<<<<<<<<<<<<<
* stats.samples_f[f] += 1
*
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_f_phrases); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_get_f_phrases); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words);
- PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_cur_scope->__pyx_v_f_words);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words);
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_13))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_13, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_cur_scope->__pyx_v_f_words); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ } else {
+ __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_f_words);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words);
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_4, NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ }
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
- __pyx_t_13 = __pyx_t_7; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) {
+ __pyx_t_13 = __pyx_t_14; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_13)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_13)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_13)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_13))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_13)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_14); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
- __pyx_t_7 = __pyx_t_5(__pyx_t_13);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_14 = __pyx_t_5(__pyx_t_13);
+ if (unlikely(!__pyx_t_14)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_14);
}
- if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
- PyObject* sequence = __pyx_t_7;
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -64397,43 +68770,43 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
} else {
- __pyx_t_14 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
__pyx_t_6 = PyList_GET_ITEM(sequence, 2);
}
- __Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(__pyx_t_6);
#else
- __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
#endif
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
- index = 0; __pyx_t_14 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_14)) goto __pyx_L18_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_14);
- index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed;
+ index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
+ index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L18_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L19_unpacking_done;
@@ -64441,76 +68814,84 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L19_unpacking_done:;
}
- __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_14);
- __pyx_t_14 = 0;
- __Pyx_XDECREF_SET(__pyx_v_lex_i, __pyx_t_4);
+ __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4);
__pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_lex_i, __pyx_t_7);
+ __pyx_t_7 = 0;
__Pyx_XDECREF_SET(__pyx_v_lex_j, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2046
+ /* "cdec/sa/rulefactory.pxi":2058
* # at the cost of readability
* for f, lex_i, lex_j in self.get_f_phrases(f_words):
* stats.samples_f[f] += 1 # <<<<<<<<<<<<<<
*
* # Update phrase counts
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_samples_f); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_samples_f); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(__pyx_v_f);
__pyx_t_6 = __pyx_v_f;
- __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_t_6); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_6, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_6, __pyx_t_14) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":2057
+ * # This could be more efficiently integrated with extraction
+ * # at the cost of readability
+ * for f, lex_i, lex_j in self.get_f_phrases(f_words): # <<<<<<<<<<<<<<
+ * stats.samples_f[f] += 1
+ *
+ */
}
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2049
+ /* "cdec/sa/rulefactory.pxi":2061
*
* # Update phrase counts
* for rule in rules: # <<<<<<<<<<<<<<
* (f_ph, e_ph, al) = rule[:3]
* stats.phrases_f[f_ph] += 1
*/
- __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_rules); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_rules); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
- __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
for (;;) {
{
- __pyx_t_7 = __pyx_t_5(__pyx_t_13);
- if (unlikely(!__pyx_t_7)) {
+ __pyx_t_14 = __pyx_t_5(__pyx_t_13);
+ if (unlikely(!__pyx_t_14)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_GOTREF(__pyx_t_14);
}
- __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_7);
- __pyx_t_7 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_14);
+ __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2050
+ /* "cdec/sa/rulefactory.pxi":2062
* # Update phrase counts
* for rule in rules:
* (f_ph, e_ph, al) = rule[:3] # <<<<<<<<<<<<<<
* stats.phrases_f[f_ph] += 1
* stats.phrases_e[e_ph] += 1
*/
- __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_slice__70, 0, 1, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
- PyObject* sequence = __pyx_t_7;
+ __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_slice__70, 0, 1, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
+ PyObject* sequence = __pyx_t_14;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -64519,43 +68900,43 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
} else {
__pyx_t_6 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_4 = PyList_GET_ITEM(sequence, 2);
+ __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
+ __pyx_t_7 = PyList_GET_ITEM(sequence, 2);
}
__Pyx_INCREF(__pyx_t_6);
- __Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_7);
#else
- __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
#endif
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L22_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
- index = 1; __pyx_t_14 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_14)) goto __pyx_L22_unpacking_failed;
- __Pyx_GOTREF(__pyx_t_14);
- index = 2; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed;
+ index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ index = 2; __pyx_t_7 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_7)) goto __pyx_L22_unpacking_failed;
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L23_unpacking_done;
@@ -64563,154 +68944,177 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L23_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_f_ph, __pyx_t_6);
__pyx_t_6 = 0;
- __Pyx_XDECREF_SET(__pyx_v_e_ph, __pyx_t_14);
- __pyx_t_14 = 0;
- __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al);
- __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_al, __pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_XDECREF_SET(__pyx_v_e_ph, __pyx_t_4);
__pyx_t_4 = 0;
+ __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al);
+ __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_al, __pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ __pyx_t_7 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2051
+ /* "cdec/sa/rulefactory.pxi":2063
* for rule in rules:
* (f_ph, e_ph, al) = rule[:3]
* stats.phrases_f[f_ph] += 1 # <<<<<<<<<<<<<<
* stats.phrases_e[e_ph] += 1
* stats.phrases_fe[f_ph][e_ph] += 1
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_f); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_INCREF(__pyx_v_f_ph);
- __pyx_t_4 = __pyx_v_f_ph;
- __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_t_4); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_f); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_v_f_ph);
+ __pyx_t_7 = __pyx_v_f_ph;
+ __pyx_t_4 = PyObject_GetItem(__pyx_t_14, __pyx_t_7); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_4, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_7, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2052
+ /* "cdec/sa/rulefactory.pxi":2064
* (f_ph, e_ph, al) = rule[:3]
* stats.phrases_f[f_ph] += 1
* stats.phrases_e[e_ph] += 1 # <<<<<<<<<<<<<<
* stats.phrases_fe[f_ph][e_ph] += 1
* if not stats.phrases_al[f_ph][e_ph]:
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_e); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_e); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_INCREF(__pyx_v_e_ph);
- __pyx_t_4 = __pyx_v_e_ph;
- __pyx_t_6 = PyObject_GetItem(__pyx_t_7, __pyx_t_4); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_7 = __pyx_v_e_ph;
+ __pyx_t_6 = PyObject_GetItem(__pyx_t_14, __pyx_t_7); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_4, __pyx_t_14) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_t_7, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2053
+ /* "cdec/sa/rulefactory.pxi":2065
* stats.phrases_f[f_ph] += 1
* stats.phrases_e[e_ph] += 1
* stats.phrases_fe[f_ph][e_ph] += 1 # <<<<<<<<<<<<<<
* if not stats.phrases_al[f_ph][e_ph]:
* stats.phrases_al[f_ph][e_ph] = al
*/
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_v_f_ph); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_INCREF(__pyx_v_e_ph);
- __pyx_t_7 = __pyx_v_e_ph;
- __pyx_t_14 = PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_14);
- __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __pyx_v_e_ph;
+ __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_t_14); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_7, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_t_14, __pyx_t_6) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2054
+ /* "cdec/sa/rulefactory.pxi":2066
* stats.phrases_e[e_ph] += 1
* stats.phrases_fe[f_ph][e_ph] += 1
* if not stats.phrases_al[f_ph][e_ph]: # <<<<<<<<<<<<<<
* stats.phrases_al[f_ph][e_ph] = al
*
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_v_f_ph); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_e_ph); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_14);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = PyObject_GetItem(__pyx_t_14, __pyx_v_e_ph); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_10 = ((!__pyx_t_12) != 0);
if (__pyx_t_10) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2055
+ /* "cdec/sa/rulefactory.pxi":2067
* stats.phrases_fe[f_ph][e_ph] += 1
* if not stats.phrases_al[f_ph][e_ph]:
* stats.phrases_al[f_ph][e_ph] = al # <<<<<<<<<<<<<<
*
* # Update bilexical dictionary
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = PyObject_GetItem(__pyx_t_4, __pyx_v_f_ph); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_al); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (unlikely(PyObject_SetItem(__pyx_t_14, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L24;
}
__pyx_L24:;
+
+ /* "cdec/sa/rulefactory.pxi":2061
+ *
+ * # Update phrase counts
+ * for rule in rules: # <<<<<<<<<<<<<<
+ * (f_ph, e_ph, al) = rule[:3]
+ * stats.phrases_f[f_ph] += 1
+ */
}
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2058
+ /* "cdec/sa/rulefactory.pxi":2070
*
* # Update bilexical dictionary
* stats.bilex.update(f_words, e_words, alignment) # <<<<<<<<<<<<<<
*
* # Create a rule from source, target, non-terminals, and alignments
*/
- __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_bilex); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
- __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_bilex); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_14);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+ __pyx_t_14 = NULL;
+ __pyx_t_2 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_14)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_14);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ __pyx_t_2 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_14) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
+ }
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words);
- PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_cur_scope->__pyx_v_f_words);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_cur_scope->__pyx_v_f_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words);
- PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_cur_scope->__pyx_v_e_words);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_cur_scope->__pyx_v_e_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words);
__Pyx_INCREF(__pyx_v_alignment);
- PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_alignment);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_2, __pyx_v_alignment);
__Pyx_GIVEREF(__pyx_v_alignment);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_13);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1894
+ /* "cdec/sa/rulefactory.pxi":1906
* # Aggregate stats from a training instance
* # (Extract rules, update counts)
* def add_instance(self, f_words, e_words, alignment, ctx_name=None): # <<<<<<<<<<<<<<
@@ -64749,7 +69153,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instanc
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
+/* "cdec/sa/rulefactory.pxi":2073
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
@@ -64796,31 +69200,31 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f_span)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e_span)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nt)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_al)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "form_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "form_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
goto __pyx_L5_argtuple_error;
@@ -64841,7 +69245,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -64854,7 +69258,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2064
+/* "cdec/sa/rulefactory.pxi":2076
*
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) # <<<<<<<<<<<<<<
@@ -64863,9 +69267,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(P
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda6 = {__Pyx_NAMESTR("lambda6"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda6, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8 = {"lambda8", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_y = 0;
int __pyx_lineno = 0;
@@ -64873,7 +69277,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0);
+ __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
PyObject* values[2] = {0,0};
@@ -64894,11 +69298,11 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lambda6", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda6") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -64911,20 +69315,20 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_la
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lambda6", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, __pyx_v_x, __pyx_v_y);
+ __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, __pyx_v_x, __pyx_v_y);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -64933,13 +69337,13 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda6", 0);
+ __Pyx_RefNannySetupContext("lambda8", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -64947,7 +69351,7 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -64959,7 +69363,7 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
@@ -64967,7 +69371,7 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2088
+/* "cdec/sa/rulefactory.pxi":2100
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1])) # <<<<<<<<<<<<<<
@@ -64976,9 +69380,9 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self
*/
/* Python wrapper */
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
-static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9 = {"lambda9", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9, METH_VARARGS|METH_KEYWORDS, 0};
+static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_y = 0;
int __pyx_lineno = 0;
@@ -64986,7 +69390,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
int __pyx_clineno = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
- __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0);
+ __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
PyObject* values[2] = {0,0};
@@ -65007,11 +69411,11 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda7") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda9") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
@@ -65024,20 +69428,20 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1l
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lambda9", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, __pyx_v_x, __pyx_v_y);
+ __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self, __pyx_v_x, __pyx_v_y);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
+static PyObject *__pyx_lambda_funcdef_lambda9(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -65046,13 +69450,13 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("lambda7", 0);
+ __Pyx_RefNannySetupContext("lambda9", 0);
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
@@ -65060,7 +69464,7 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_cmp, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
@@ -65072,16 +69476,16 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda9", __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_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122
+/* "cdec/sa/rulefactory.pxi":2134
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
@@ -65090,45 +69494,42 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator16, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_form_rule_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -65152,19 +69553,19 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) { __Pyx_RaiseClosureNameError("links"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links)) { __Pyx_RaiseClosureNameError("links"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_links == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_links; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
for (;;) {
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
@@ -65176,7 +69577,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
@@ -65189,15 +69590,15 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
#else
- __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
@@ -65205,7 +69606,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L7_unpacking_done;
@@ -65213,7 +69614,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
@@ -65224,10 +69625,10 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_j, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment->__pyx_vtab)->link(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment, __pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment->__pyx_vtab)->link(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment, __pyx_t_8, __pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -65244,7 +69645,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -65266,7 +69667,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
+/* "cdec/sa/rulefactory.pxi":2073
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
@@ -65275,7 +69676,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_4g
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_e_i, PyObject *__pyx_v_f_span, PyObject *__pyx_v_e_span, PyObject *__pyx_v_nt, PyObject *__pyx_v_al) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *__pyx_cur_scope;
PyObject *__pyx_v_nt_inv = NULL;
PyObject *__pyx_v_f_sym = NULL;
PyObject *__pyx_v_off = NULL;
@@ -65308,12 +69709,11 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
PyObject *(*__pyx_t_11)(PyObject *);
PyObject *__pyx_t_12 = NULL;
int __pyx_t_13;
- int __pyx_t_14;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("form_rule", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -65323,52 +69723,52 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2064
+ /* "cdec/sa/rulefactory.pxi":2076
*
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) # <<<<<<<<<<<<<<
* f_sym = list(f_span[:])
* off = f_i
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_nt);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nt);
__Pyx_GIVEREF(__pyx_v_nt);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda6, 0, __pyx_n_s_form_rule_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda8, 0, __pyx_n_s_form_rule_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cmp, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cmp, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_nt_inv = __pyx_t_3;
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2065
+ /* "cdec/sa/rulefactory.pxi":2077
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:]) # <<<<<<<<<<<<<<
* off = f_i
* for next_nt in nt:
*/
- __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_f_span, 0, 0, NULL, NULL, &__pyx_slice__71, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_f_span, 0, 0, NULL, NULL, &__pyx_slice__71, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_f_sym = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066
+ /* "cdec/sa/rulefactory.pxi":2078
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:])
* off = f_i # <<<<<<<<<<<<<<
@@ -65378,43 +69778,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__pyx_v_off = __pyx_v_f_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067
+ /* "cdec/sa/rulefactory.pxi":2079
* f_sym = list(f_span[:])
* off = f_i
* for next_nt in nt: # <<<<<<<<<<<<<<
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0
*/
- if (PyList_CheckExact(__pyx_v_nt) || PyTuple_CheckExact(__pyx_v_nt)) {
+ if (likely(PyList_CheckExact(__pyx_v_nt)) || PyTuple_CheckExact(__pyx_v_nt)) {
__pyx_t_3 = __pyx_v_nt; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_2 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -65423,28 +69825,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068
+ /* "cdec/sa/rulefactory.pxi":2080
* off = f_i
* for next_nt in nt:
* nt_len = (next_nt[2] - next_nt[1]) + 1 # <<<<<<<<<<<<<<
* i = 0
* while i < nt_len:
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069
+ /* "cdec/sa/rulefactory.pxi":2081
* for next_nt in nt:
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -65454,7 +69856,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070
+ /* "cdec/sa/rulefactory.pxi":2082
* nt_len = (next_nt[2] - next_nt[1]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -65462,103 +69864,111 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* i += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071
+ /* "cdec/sa/rulefactory.pxi":2083
* i = 0
* while i < nt_len:
* f_sym.pop(next_nt[1] - off) # <<<<<<<<<<<<<<
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyList_PopIndex(__pyx_v_f_sym, __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyList_PopIndex(__pyx_v_f_sym, __pyx_t_8, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072
+ /* "cdec/sa/rulefactory.pxi":2084
* while i < nt_len:
* f_sym.pop(next_nt[1] - off)
* i += 1 # <<<<<<<<<<<<<<
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
*/
- __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_6);
__pyx_t_6 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073
+ /* "cdec/sa/rulefactory.pxi":2085
* f_sym.pop(next_nt[1] - off)
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0])) # <<<<<<<<<<<<<<
* off += (nt_len - 1)
* e_sym = list(e_span[:])
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074
+ /* "cdec/sa/rulefactory.pxi":2086
* i += 1
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1) # <<<<<<<<<<<<<<
* e_sym = list(e_span[:])
* off = e_i
*/
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_6);
__pyx_t_6 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":2079
+ * f_sym = list(f_span[:])
+ * off = f_i
+ * for next_nt in nt: # <<<<<<<<<<<<<<
+ * nt_len = (next_nt[2] - next_nt[1]) + 1
+ * i = 0
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075
+ /* "cdec/sa/rulefactory.pxi":2087
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
* e_sym = list(e_span[:]) # <<<<<<<<<<<<<<
* off = e_i
* for next_nt in nt_inv:
*/
- __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_e_span, 0, 0, NULL, NULL, &__pyx_slice__72, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_e_span, 0, 0, NULL, NULL, &__pyx_slice__72, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_e_sym = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076
+ /* "cdec/sa/rulefactory.pxi":2088
* off += (nt_len - 1)
* e_sym = list(e_span[:])
* off = e_i # <<<<<<<<<<<<<<
@@ -65568,43 +69978,45 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_e_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077
+ /* "cdec/sa/rulefactory.pxi":2089
* e_sym = list(e_span[:])
* off = e_i
* for next_nt in nt_inv: # <<<<<<<<<<<<<<
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0
*/
- if (PyList_CheckExact(__pyx_v_nt_inv) || PyTuple_CheckExact(__pyx_v_nt_inv)) {
+ if (likely(PyList_CheckExact(__pyx_v_nt_inv)) || PyTuple_CheckExact(__pyx_v_nt_inv)) {
__pyx_t_3 = __pyx_v_nt_inv; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt_inv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_nt_inv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_3))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -65613,28 +70025,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_XDECREF_SET(__pyx_v_next_nt, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2078
+ /* "cdec/sa/rulefactory.pxi":2090
* off = e_i
* for next_nt in nt_inv:
* nt_len = (next_nt[4] - next_nt[3]) + 1 # <<<<<<<<<<<<<<
* i = 0
* while i < nt_len:
*/
- __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079
+ /* "cdec/sa/rulefactory.pxi":2091
* for next_nt in nt_inv:
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0 # <<<<<<<<<<<<<<
@@ -65644,7 +70056,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2080
+ /* "cdec/sa/rulefactory.pxi":2092
* nt_len = (next_nt[4] - next_nt[3]) + 1
* i = 0
* while i < nt_len: # <<<<<<<<<<<<<<
@@ -65652,121 +70064,131 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* i += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081
+ /* "cdec/sa/rulefactory.pxi":2093
* i = 0
* while i < nt_len:
* e_sym.pop(next_nt[3] - off) # <<<<<<<<<<<<<<
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
*/
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyList_PopIndex(__pyx_v_e_sym, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyList_PopIndex(__pyx_v_e_sym, __pyx_t_8, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082
+ /* "cdec/sa/rulefactory.pxi":2094
* while i < nt_len:
* e_sym.pop(next_nt[3] - off)
* i += 1 # <<<<<<<<<<<<<<
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
*/
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2);
__pyx_t_2 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083
+ /* "cdec/sa/rulefactory.pxi":2095
* e_sym.pop(next_nt[3] - off)
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0])) # <<<<<<<<<<<<<<
* off += (nt_len - 1)
*
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_10 = PyList_Insert(__pyx_v_e_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_10 = PyList_Insert(__pyx_v_e_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084
+ /* "cdec/sa/rulefactory.pxi":2096
* i += 1
* e_sym.insert(next_nt[3] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1) # <<<<<<<<<<<<<<
*
* # Adjusting alignment links takes some doing
*/
- __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_2);
__pyx_t_2 = 0;
+
+ /* "cdec/sa/rulefactory.pxi":2089
+ * e_sym = list(e_span[:])
+ * off = e_i
+ * for next_nt in nt_inv: # <<<<<<<<<<<<<<
+ * nt_len = (next_nt[4] - next_nt[3]) + 1
+ * i = 0
+ */
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2087
+ /* "cdec/sa/rulefactory.pxi":2099
*
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub] # <<<<<<<<<<<<<<
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links)
*/
- __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- if (PyList_CheckExact(__pyx_v_al) || PyTuple_CheckExact(__pyx_v_al)) {
+ if (likely(PyList_CheckExact(__pyx_v_al)) || PyTuple_CheckExact(__pyx_v_al)) {
__pyx_t_2 = __pyx_v_al; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
- __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_al); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_al); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
+ __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
- if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_5)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_1 = __pyx_t_5(__pyx_t_2);
if (unlikely(!__pyx_t_1)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -65774,36 +70196,38 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__Pyx_XDECREF_SET(__pyx_v_sub, __pyx_t_1);
__pyx_t_1 = 0;
- if (PyList_CheckExact(__pyx_v_sub) || PyTuple_CheckExact(__pyx_v_sub)) {
+ if (likely(PyList_CheckExact(__pyx_v_sub)) || PyTuple_CheckExact(__pyx_v_sub)) {
__pyx_t_1 = __pyx_v_sub; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
__pyx_t_11 = NULL;
} else {
- __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sub); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_11)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_6 = __pyx_t_11(__pyx_t_1);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -65811,15 +70235,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
}
__Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_6);
__pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_link);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_link);
__Pyx_GIVEREF(__pyx_v_link);
- __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), __pyx_t_6, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -65829,32 +70253,32 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_cur_scope->__pyx_v_links = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2088
+ /* "cdec/sa/rulefactory.pxi":2100
* # Adjusting alignment links takes some doing
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1])) # <<<<<<<<<<<<<<
* links_len = len(links)
* nt_len = len(nt)
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_links);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_links);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_links);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda7, 0, __pyx_n_s_form_rule_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda9, 0, __pyx_n_s_form_rule_locals_lambda, NULL, __pyx_n_s_cdec_sa__sa, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cmp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_cmp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_links_inv = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089
+ /* "cdec/sa/rulefactory.pxi":2101
* links = [list(link) for sub in al for link in sub]
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links) # <<<<<<<<<<<<<<
@@ -65865,26 +70289,26 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_t_1);
if (unlikely(__pyx_t_1 == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_links_len = __pyx_t_4;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090
+ /* "cdec/sa/rulefactory.pxi":2102
* links_inv = sorted(links, cmp=lambda x, y: cmp(x[1], y[1]))
* links_len = len(links)
* nt_len = len(nt) # <<<<<<<<<<<<<<
* nt_i = 0
* off = f_i
*/
- __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_nt_len, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091
+ /* "cdec/sa/rulefactory.pxi":2103
* links_len = len(links)
* nt_len = len(nt)
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -65894,7 +70318,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__pyx_v_nt_i = __pyx_int_0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092
+ /* "cdec/sa/rulefactory.pxi":2104
* nt_len = len(nt)
* nt_i = 0
* off = f_i # <<<<<<<<<<<<<<
@@ -65904,7 +70328,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_f_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093
+ /* "cdec/sa/rulefactory.pxi":2105
* nt_i = 0
* off = f_i
* i = 0 # <<<<<<<<<<<<<<
@@ -65914,7 +70338,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_XDECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094
+ /* "cdec/sa/rulefactory.pxi":2106
* off = f_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
@@ -65922,15 +70346,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* off += (nt[nt_i][2] - nt[nt_i][1])
*/
while (1) {
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_links_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_links_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095
+ /* "cdec/sa/rulefactory.pxi":2107
* i = 0
* while i < links_len:
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]: # <<<<<<<<<<<<<<
@@ -65938,104 +70362,108 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* nt_i += 1
*/
while (1) {
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_7) {
- __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_14 = __pyx_t_13;
+ if (__pyx_t_13) {
+ goto __pyx_L20_next_and;
} else {
- __pyx_t_14 = __pyx_t_7;
+ __pyx_t_7 = __pyx_t_13;
+ goto __pyx_L19_bool_binop_done;
}
- if (!__pyx_t_14) break;
+ __pyx_L20_next_and:;
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_7 = __pyx_t_13;
+ __pyx_L19_bool_binop_done:;
+ if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096
+ /* "cdec/sa/rulefactory.pxi":2108
* while i < links_len:
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]:
* off += (nt[nt_i][2] - nt[nt_i][1]) # <<<<<<<<<<<<<<
* nt_i += 1
* links[i][0] -= off
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097
+ /* "cdec/sa/rulefactory.pxi":2109
* while nt_i < nt_len and links[i][0] > nt[nt_i][1]:
* off += (nt[nt_i][2] - nt[nt_i][1])
* nt_i += 1 # <<<<<<<<<<<<<<
* links[i][0] -= off
* i += 1
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098
+ /* "cdec/sa/rulefactory.pxi":2110
* off += (nt[nt_i][2] - nt[nt_i][1])
* nt_i += 1
* links[i][0] -= off # <<<<<<<<<<<<<<
* i += 1
* nt_i = 0
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_links, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = 0;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_t_4, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_t_4, __pyx_t_3, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099
+ /* "cdec/sa/rulefactory.pxi":2111
* nt_i += 1
* links[i][0] -= off
* i += 1 # <<<<<<<<<<<<<<
* nt_i = 0
* off = e_i
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100
+ /* "cdec/sa/rulefactory.pxi":2112
* links[i][0] -= off
* i += 1
* nt_i = 0 # <<<<<<<<<<<<<<
@@ -66045,7 +70473,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101
+ /* "cdec/sa/rulefactory.pxi":2113
* i += 1
* nt_i = 0
* off = e_i # <<<<<<<<<<<<<<
@@ -66055,7 +70483,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_e_i);
__Pyx_DECREF_SET(__pyx_v_off, __pyx_v_e_i);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102
+ /* "cdec/sa/rulefactory.pxi":2114
* nt_i = 0
* off = e_i
* i = 0 # <<<<<<<<<<<<<<
@@ -66065,7 +70493,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_int_0);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_int_0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103
+ /* "cdec/sa/rulefactory.pxi":2115
* off = e_i
* i = 0
* while i < links_len: # <<<<<<<<<<<<<<
@@ -66073,15 +70501,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
*/
while (1) {
- __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_links_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_links_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_i, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (!__pyx_t_14) break;
+ if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104
+ /* "cdec/sa/rulefactory.pxi":2116
* i = 0
* while i < links_len:
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]: # <<<<<<<<<<<<<<
@@ -66089,104 +70517,108 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* nt_i += 1
*/
while (1) {
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_14) {
- __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_13 = __pyx_t_7;
+ if (__pyx_t_13) {
+ goto __pyx_L26_next_and;
} else {
- __pyx_t_13 = __pyx_t_14;
+ __pyx_t_7 = __pyx_t_13;
+ goto __pyx_L25_bool_binop_done;
}
- if (!__pyx_t_13) break;
+ __pyx_L26_next_and:;
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_7 = __pyx_t_13;
+ __pyx_L25_bool_binop_done:;
+ if (!__pyx_t_7) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105
+ /* "cdec/sa/rulefactory.pxi":2117
* while i < links_len:
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]:
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) # <<<<<<<<<<<<<<
* nt_i += 1
* links_inv[i][1] -= off
*/
- __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_off, __pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106
+ /* "cdec/sa/rulefactory.pxi":2118
* while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]:
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
* nt_i += 1 # <<<<<<<<<<<<<<
* links_inv[i][1] -= off
* i += 1
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_nt_i, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107
+ /* "cdec/sa/rulefactory.pxi":2119
* off += (nt_inv[nt_i][4] - nt_inv[nt_i][3])
* nt_i += 1
* links_inv[i][1] -= off # <<<<<<<<<<<<<<
* i += 1
*
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = 1;
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_t_4, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_SetItemInt(__pyx_t_1, __pyx_t_4, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108
+ /* "cdec/sa/rulefactory.pxi":2120
* nt_i += 1
* links_inv[i][1] -= off
* i += 1 # <<<<<<<<<<<<<<
*
* # Find lexical span
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_i, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2111
+ /* "cdec/sa/rulefactory.pxi":2123
*
* # Find lexical span
* lex_f_i = f_i # <<<<<<<<<<<<<<
@@ -66196,194 +70628,194 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__Pyx_INCREF(__pyx_v_f_i);
__pyx_v_lex_f_i = __pyx_v_f_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2112
+ /* "cdec/sa/rulefactory.pxi":2124
* # Find lexical span
* lex_f_i = f_i
* lex_f_j = f_i + (len(f_span) - 1) # <<<<<<<<<<<<<<
* if nt:
* if nt[0][1] == lex_f_i:
*/
- __pyx_t_4 = PyObject_Length(__pyx_v_f_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Length(__pyx_v_f_span); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_i, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_f_i, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_lex_f_j = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113
+ /* "cdec/sa/rulefactory.pxi":2125
* lex_f_i = f_i
* lex_f_j = f_i + (len(f_span) - 1)
* if nt: # <<<<<<<<<<<<<<
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
*/
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_13) {
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114
+ /* "cdec/sa/rulefactory.pxi":2126
* lex_f_j = f_i + (len(f_span) - 1)
* if nt:
* if nt[0][1] == lex_f_i: # <<<<<<<<<<<<<<
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j:
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_13) {
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115
+ /* "cdec/sa/rulefactory.pxi":2127
* if nt:
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1 # <<<<<<<<<<<<<<
* if nt[-1][2] == lex_f_j:
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF_SET(__pyx_v_lex_f_i, __pyx_t_2);
__pyx_t_2 = 0;
- goto __pyx_L24;
+ goto __pyx_L28;
}
- __pyx_L24:;
+ __pyx_L28:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116
+ /* "cdec/sa/rulefactory.pxi":2128
* if nt[0][1] == lex_f_i:
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j: # <<<<<<<<<<<<<<
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1
*
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_13) {
+ if (__pyx_t_7) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117
+ /* "cdec/sa/rulefactory.pxi":2129
* lex_f_i += (nt[0][2] - nt[0][1]) + 1
* if nt[-1][2] == lex_f_j:
* lex_f_j -= (nt[-1][2] - nt[-1][1]) + 1 # <<<<<<<<<<<<<<
*
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
*/
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF_SET(__pyx_v_lex_f_j, __pyx_t_2);
__pyx_t_2 = 0;
- goto __pyx_L25;
+ goto __pyx_L29;
}
- __pyx_L25:;
- goto __pyx_L23;
+ __pyx_L29:;
+ goto __pyx_L27;
}
- __pyx_L23:;
+ __pyx_L27:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2120
+ /* "cdec/sa/rulefactory.pxi":2132
*
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
* f = Phrase(f_sym) # <<<<<<<<<<<<<<
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links)
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_f_sym);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f_sym);
__Pyx_GIVEREF(__pyx_v_f_sym);
- __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2121
+ /* "cdec/sa/rulefactory.pxi":2133
* # Create rule (f_phrase, e_phrase, links, f_link_min, f_link_max)
* f = Phrase(f_sym)
* e = Phrase(e_sym) # <<<<<<<<<<<<<<
* a = tuple(self.alignment.link(i, j) for i, j in links)
* return (f, e, a, lex_f_i, lex_f_j)
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_e_sym);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_e_sym);
__Pyx_GIVEREF(__pyx_v_e_sym);
- __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122
+ /* "cdec/sa/rulefactory.pxi":2134
* f = Phrase(f_sym)
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<<
* return (f, e, a, lex_f_i, lex_f_j)
*
*/
- __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_a = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123
+ /* "cdec/sa/rulefactory.pxi":2135
* e = Phrase(e_sym)
* a = tuple(self.alignment.link(i, j) for i, j in links)
* return (f, e, a, lex_f_i, lex_f_j) # <<<<<<<<<<<<<<
@@ -66391,7 +70823,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
* # Rule string from rule
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_f));
@@ -66412,7 +70844,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2061
+ /* "cdec/sa/rulefactory.pxi":2073
*
* # Create a rule from source, target, non-terminals, and alignments
* def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<<
@@ -66452,7 +70884,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(s
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
+/* "cdec/sa/rulefactory.pxi":2138
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
@@ -66493,16 +70925,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmt_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmt_rule") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -66517,7 +70949,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -66529,9 +70961,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(Py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2127
+/* "cdec/sa/rulefactory.pxi":2139
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
@@ -66540,45 +70972,42 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator17, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_fmt_rule_locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -66587,6 +71016,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -66600,38 +71030,40 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) {
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_a; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
- __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
- else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
@@ -66641,29 +71073,45 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_packed, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_1, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_1, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment), __pyx_n_s_unlink); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->alignment), __pyx_n_s_unlink); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(__pyx_cur_scope->__pyx_v_packed);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_packed);
- __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_packed);
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_7 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ }
+ }
+ if (!__pyx_t_7) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_cur_scope->__pyx_v_packed); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_8);
+ PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_packed);
+ PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_cur_scope->__pyx_v_packed);
+ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_packed);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ }
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_7;
- __pyx_t_7 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
__Pyx_XGIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
@@ -66679,7 +71127,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
- if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -66692,6 +71140,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r);
@@ -66701,7 +71150,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
+/* "cdec/sa/rulefactory.pxi":2138
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
@@ -66710,18 +71159,20 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2ge
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *__pyx_cur_scope;
PyObject *__pyx_v_a_str = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fmt_rule", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -66734,22 +71185,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2127
+ /* "cdec/sa/rulefactory.pxi":2139
* # Rule string from rule
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) # <<<<<<<<<<<<<<
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str)
*
*/
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__46, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__46, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_a_str = ((PyObject*)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128
+ /* "cdec/sa/rulefactory.pxi":2140
* def fmt_rule(self, f, e, a):
* a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a)
* return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str) # <<<<<<<<<<<<<<
@@ -66757,28 +71208,43 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
* # Lookup online stats for phrase pair (f, e). Return None if no match.
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_X_0_1_2, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_X_0_1_2, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = NULL;
+ __pyx_t_4 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_1, function);
+ __pyx_t_4 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_f);
__Pyx_GIVEREF(__pyx_v_f);
__Pyx_INCREF(__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_e);
__Pyx_GIVEREF(__pyx_v_e);
__Pyx_INCREF(__pyx_v_a_str);
- PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_a_str);
+ PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_a_str);
__Pyx_GIVEREF(__pyx_v_a_str);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2126
+ /* "cdec/sa/rulefactory.pxi":2138
*
* # Rule string from rule
* def fmt_rule(self, f, e, a): # <<<<<<<<<<<<<<
@@ -66791,6 +71257,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -66801,7 +71268,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2132
+/* "cdec/sa/rulefactory.pxi":2144
* # Lookup online stats for phrase pair (f, e). Return None if no match.
* # IMPORTANT: use get() to avoid adding items to defaultdict
* def online_ctx_lookup(self, f, e, ctx_name=None): # <<<<<<<<<<<<<<
@@ -66843,7 +71310,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
@@ -66852,7 +71319,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "online_ctx_lookup") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "online_ctx_lookup") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -66869,7 +71336,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -66894,13 +71361,15 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("online_ctx_lookup", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2133
+ /* "cdec/sa/rulefactory.pxi":2145
* # IMPORTANT: use get() to avoid adding items to defaultdict
* def online_ctx_lookup(self, f, e, ctx_name=None):
* if self.online: # <<<<<<<<<<<<<<
@@ -66910,124 +71379,184 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_t_1 = (__pyx_v_self->online != 0);
if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134
+ /* "cdec/sa/rulefactory.pxi":2146
* def online_ctx_lookup(self, f, e, ctx_name=None):
* if self.online:
* stats = self.online_stats[ctx_name] # <<<<<<<<<<<<<<
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0)
*/
- __pyx_t_2 = PyObject_GetItem(__pyx_v_self->online_stats, __pyx_v_ctx_name); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_2 = PyObject_GetItem(__pyx_v_self->online_stats, __pyx_v_ctx_name); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_stats = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135
+ /* "cdec/sa/rulefactory.pxi":2147
* if self.online:
* stats = self.online_stats[ctx_name]
* fcount = stats.phrases_f.get(f, 0) # <<<<<<<<<<<<<<
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None)
*/
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_f);
__Pyx_GIVEREF(__pyx_v_f);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_v_fcount = __pyx_t_4;
- __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_fcount = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2136
+ /* "cdec/sa/rulefactory.pxi":2148
* stats = self.online_stats[ctx_name]
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0) # <<<<<<<<<<<<<<
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_samples_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_samples_f); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_3 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_5, __pyx_v_f);
__Pyx_GIVEREF(__pyx_v_f);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_5, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_fsample_count = __pyx_t_3;
- __pyx_t_3 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_fsample_count = __pyx_t_2;
+ __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2137
+ /* "cdec/sa/rulefactory.pxi":2149
* fcount = stats.phrases_f.get(f, 0)
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None) # <<<<<<<<<<<<<<
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex)
*/
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_phrases_fe); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_6 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ if (__pyx_t_6) {
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ }
__Pyx_INCREF(__pyx_v_f);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_f);
__Pyx_GIVEREF(__pyx_v_f);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_d = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138
+ /* "cdec/sa/rulefactory.pxi":2150
* fsample_count = stats.samples_f.get(f, 0)
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0 # <<<<<<<<<<<<<<
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex)
* return None
*/
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_4, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_7 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_7);
+ if (__pyx_t_6) {
+ PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
+ }
__Pyx_INCREF(__pyx_v_e);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e);
+ PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_5, __pyx_v_e);
__Pyx_GIVEREF(__pyx_v_e);
__Pyx_INCREF(__pyx_int_0);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
+ PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_5, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_2 = __pyx_t_5;
- __pyx_t_5 = 0;
+ __pyx_t_2 = __pyx_t_3;
+ __pyx_t_3 = 0;
} else {
__Pyx_INCREF(__pyx_int_0);
__pyx_t_2 = __pyx_int_0;
@@ -67035,7 +71564,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_v_paircount = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139
+ /* "cdec/sa/rulefactory.pxi":2151
* d = stats.phrases_fe.get(f, None)
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex) # <<<<<<<<<<<<<<
@@ -67043,34 +71572,49 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
*
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_OnlineFeatureContext); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_bilex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_OnlineFeatureContext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s_bilex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_7 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_3, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
__Pyx_INCREF(__pyx_v_fcount);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fcount);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_fcount);
__Pyx_GIVEREF(__pyx_v_fcount);
__Pyx_INCREF(__pyx_v_fsample_count);
- PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_fsample_count);
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_fsample_count);
__Pyx_GIVEREF(__pyx_v_fsample_count);
__Pyx_INCREF(__pyx_v_paircount);
- PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_paircount);
+ PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_paircount);
__Pyx_GIVEREF(__pyx_v_paircount);
- PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_r = __pyx_t_5;
- __pyx_t_5 = 0;
+ PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_t_4 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140
+ /* "cdec/sa/rulefactory.pxi":2152
* paircount = d.get(e, 0) if d else 0
* return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex)
* return None # <<<<<<<<<<<<<<
@@ -67082,7 +71626,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__pyx_r = Py_None;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2132
+ /* "cdec/sa/rulefactory.pxi":2144
* # Lookup online stats for phrase pair (f, e). Return None if no match.
* # IMPORTANT: use get() to avoid adding items to defaultdict
* def online_ctx_lookup(self, f, e, ctx_name=None): # <<<<<<<<<<<<<<
@@ -67095,7 +71639,8 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -67109,7 +71654,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+/* "cdec/sa/rulefactory.pxi":2157
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
@@ -67130,7 +71675,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phras
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
+/* "cdec/sa/rulefactory.pxi":2162
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
@@ -67140,7 +71685,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phras
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract = {__Pyx_NAMESTR("extract"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract = {"extract", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_f_i = 0;
PyObject *__pyx_v_f_j = 0;
@@ -67180,36 +71725,36 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lex_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lex_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ntc)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_syms)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extract") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
goto __pyx_L5_argtuple_error;
@@ -67232,7 +71777,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -67246,64 +71791,67 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
}
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(PyObject *__pyx_self, PyObject *__pyx_v_f_i, PyObject *__pyx_v_f_j, PyObject *__pyx_v_lex_i, PyObject *__pyx_v_lex_j, PyObject *__pyx_v_wc, PyObject *__pyx_v_ntc, PyObject *__pyx_v_syms) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_cur_scope;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_outer_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *__pyx_outer_scope;
struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = NULL;
PyObject *__pyx_v_new_lex_i = NULL;
PyObject *__pyx_v_new_lex_j = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
- int __pyx_t_7;
- PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
int __pyx_t_9;
- int __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("extract", 0);
- __pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *) __Pyx_CyFunction_GetClosure(__pyx_self);
+ __pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152
+ /* "cdec/sa/rulefactory.pxi":2164
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms):
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: # <<<<<<<<<<<<<<
* return
* # Extend with word
*/
- __pyx_t_1 = PyInt_FromSsize_t((__pyx_cur_scope->__pyx_v_f_len - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyInt_FromSsize_t((__pyx_cur_scope->__pyx_v_f_len - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_f_j, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (!__pyx_t_3) {
- __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __pyx_t_5;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (!__pyx_t_4) {
+ goto __pyx_L5_next_or;
} else {
- __pyx_t_6 = __pyx_t_3;
+ __pyx_t_1 = __pyx_t_4;
+ goto __pyx_L4_bool_binop_done;
}
- if (__pyx_t_6) {
+ __pyx_L5_next_or:;
+ __pyx_t_3 = PyNumber_Subtract(__pyx_v_f_j, __pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2153
+ /* "cdec/sa/rulefactory.pxi":2165
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
* return # <<<<<<<<<<<<<<
@@ -67315,57 +71863,57 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155
+ /* "cdec/sa/rulefactory.pxi":2167
* return
* # Extend with word
* if wc + ntc < self.max_length: # <<<<<<<<<<<<<<
* syms.append(f_words[f_j])
* f = Phrase(syms)
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_5 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_6) {
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2156
+ /* "cdec/sa/rulefactory.pxi":2168
* # Extend with word
* if wc + ntc < self.max_length:
* syms.append(f_words[f_j]) # <<<<<<<<<<<<<<
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j)
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_f_words)) { __Pyx_RaiseClosureNameError("f_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157
+ /* "cdec/sa/rulefactory.pxi":2169
* if wc + ntc < self.max_length:
* syms.append(f_words[f_j])
* f = Phrase(syms) # <<<<<<<<<<<<<<
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j)
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_syms);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_syms);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_syms);
__Pyx_GIVEREF(__pyx_v_syms);
- __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_2);
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3);
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158
+ /* "cdec/sa/rulefactory.pxi":2170
* syms.append(f_words[f_j])
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j) # <<<<<<<<<<<<<<
@@ -67373,28 +71921,28 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
* phrases.add((f, new_lex_i, new_lex_j))
*/
__Pyx_INCREF(__pyx_v_f_j);
- __pyx_t_2 = __pyx_v_f_j;
+ __pyx_t_3 = __pyx_v_f_j;
__Pyx_INCREF(__pyx_v_lex_i);
- __pyx_t_1 = __pyx_v_lex_i;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_4 = __pyx_t_2;
+ __pyx_t_2 = __pyx_v_lex_i;
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_1) {
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_5 = __pyx_t_3;
} else {
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = __pyx_t_1;
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_5 = __pyx_t_2;
}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __pyx_t_4;
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_v_new_lex_i = __pyx_t_2;
- __pyx_t_2 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __pyx_t_5;
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_new_lex_i = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2159
+ /* "cdec/sa/rulefactory.pxi":2171
* f = Phrase(syms)
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j) # <<<<<<<<<<<<<<
@@ -67402,286 +71950,297 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms)
*/
__Pyx_INCREF(__pyx_v_f_j);
- __pyx_t_2 = __pyx_v_f_j;
+ __pyx_t_3 = __pyx_v_f_j;
__Pyx_INCREF(__pyx_v_lex_j);
- __pyx_t_4 = __pyx_v_lex_j;
- __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (__pyx_t_6) {
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __pyx_t_2;
+ __pyx_t_5 = __pyx_v_lex_j;
+ __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ if (__pyx_t_1) {
+ __Pyx_INCREF(__pyx_t_3);
+ __pyx_t_2 = __pyx_t_3;
} else {
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_1 = __pyx_t_4;
+ __Pyx_INCREF(__pyx_t_5);
+ __pyx_t_2 = __pyx_t_5;
}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __pyx_t_2;
+ __Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = __pyx_t_1;
- __Pyx_INCREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_new_lex_j = __pyx_t_2;
- __pyx_t_2 = 0;
+ __pyx_v_new_lex_j = __pyx_t_3;
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2160
+ /* "cdec/sa/rulefactory.pxi":2172
* new_lex_i = min(lex_i, f_j)
* new_lex_j = max(lex_j, f_j)
* phrases.add((f, new_lex_i, new_lex_j)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms)
* syms.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_phrases == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_f));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_f));
__Pyx_GIVEREF(((PyObject *)__pyx_v_f));
__Pyx_INCREF(__pyx_v_new_lex_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_new_lex_i);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_lex_i);
__Pyx_GIVEREF(__pyx_v_new_lex_i);
__Pyx_INCREF(__pyx_v_new_lex_j);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_new_lex_j);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_new_lex_j);
__Pyx_GIVEREF(__pyx_v_new_lex_j);
- __pyx_t_7 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_6 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2161
+ /* "cdec/sa/rulefactory.pxi":2173
* new_lex_j = max(lex_j, f_j)
* phrases.add((f, new_lex_i, new_lex_j))
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms) # <<<<<<<<<<<<<<
* syms.pop()
* # Extend with existing non-terminal
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_1, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_3, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2162
+ /* "cdec/sa/rulefactory.pxi":2174
* phrases.add((f, new_lex_i, new_lex_j))
* extract(f_i, f_j + 1, new_lex_i, new_lex_j, wc + 1, ntc, syms)
* syms.pop() # <<<<<<<<<<<<<<
* # Extend with existing non-terminal
* if syms and sym_isvar(syms[-1]):
*/
- __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- goto __pyx_L4;
+ __pyx_t_5 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L6;
}
- __pyx_L4:;
+ __pyx_L6:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2164
+ /* "cdec/sa/rulefactory.pxi":2176
* syms.pop()
* # Extend with existing non-terminal
* if syms and sym_isvar(syms[-1]): # <<<<<<<<<<<<<<
* # Don't re-extract the same phrase
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms)
*/
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_6) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_9) != 0);
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_4) {
+ goto __pyx_L9_next_and;
} else {
- __pyx_t_3 = __pyx_t_6;
+ __pyx_t_1 = __pyx_t_4;
+ goto __pyx_L8_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L9_next_and:;
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_syms, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_4 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_8) != 0);
+ __pyx_t_1 = __pyx_t_4;
+ __pyx_L8_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2166
+ /* "cdec/sa/rulefactory.pxi":2178
* if syms and sym_isvar(syms[-1]):
* # Don't re-extract the same phrase
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms) # <<<<<<<<<<<<<<
* # Extend with new non-terminal
* if wc + ntc < self.max_length:
*/
- __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L5;
+ __pyx_t_5 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_5, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L7;
}
- __pyx_L5:;
+ __pyx_L7:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168
+ /* "cdec/sa/rulefactory.pxi":2180
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc, syms)
* # Extend with new non-terminal
* if wc + ntc < self.max_length: # <<<<<<<<<<<<<<
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1))
*/
- __pyx_t_1 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_3) {
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2169
+ /* "cdec/sa/rulefactory.pxi":2181
* # Extend with new non-terminal
* if wc + ntc < self.max_length:
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])): # <<<<<<<<<<<<<<
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms)
*/
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6 = (!__pyx_t_3);
- if (!__pyx_t_6) {
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_3) {
- __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = (!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_9) != 0));
- __pyx_t_10 = __pyx_t_5;
- } else {
- __pyx_t_10 = __pyx_t_3;
- }
- __pyx_t_3 = __pyx_t_10;
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_9 = ((!__pyx_t_4) != 0);
+ if (!__pyx_t_9) {
+ goto __pyx_L13_next_or;
} else {
- __pyx_t_3 = __pyx_t_6;
+ __pyx_t_1 = __pyx_t_9;
+ goto __pyx_L12_bool_binop_done;
}
- if (__pyx_t_3) {
+ __pyx_L13_next_or:;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (__pyx_t_9) {
+ goto __pyx_L14_next_and;
+ } else {
+ __pyx_t_1 = __pyx_t_9;
+ goto __pyx_L12_bool_binop_done;
+ }
+ __pyx_L14_next_and:;
+ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_syms, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_8) != 0)) != 0);
+ __pyx_t_1 = __pyx_t_9;
+ __pyx_L12_bool_binop_done:;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170
+ /* "cdec/sa/rulefactory.pxi":2182
* if wc + ntc < self.max_length:
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1)) # <<<<<<<<<<<<<<
* f = Phrase(syms)
* if wc > 0:
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_5 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171
+ /* "cdec/sa/rulefactory.pxi":2183
* if not syms or (ntc < self.max_nonterminals and not sym_isvar(syms[-1])):
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms) # <<<<<<<<<<<<<<
* if wc > 0:
* phrases.add((f, lex_i, lex_j))
*/
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_v_syms);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_syms);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_syms);
__Pyx_GIVEREF(__pyx_v_syms);
- __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF_SET(__pyx_v_f, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_2));
- __pyx_t_2 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_f, ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3));
+ __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2172
+ /* "cdec/sa/rulefactory.pxi":2184
* syms.append(sym_setindex(self.category, ntc + 1))
* f = Phrase(syms)
* if wc > 0: # <<<<<<<<<<<<<<
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
*/
- __pyx_t_2 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_3) {
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (__pyx_t_1) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173
+ /* "cdec/sa/rulefactory.pxi":2185
* f = Phrase(syms)
* if wc > 0:
* phrases.add((f, lex_i, lex_j)) # <<<<<<<<<<<<<<
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
* syms.pop()
*/
- if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ if (unlikely(!__pyx_cur_scope->__pyx_v_phrases)) { __Pyx_RaiseClosureNameError("phrases"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
if (unlikely(__pyx_cur_scope->__pyx_v_phrases == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add");
- {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_f));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_f));
+ PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_f));
__Pyx_GIVEREF(((PyObject *)__pyx_v_f));
__Pyx_INCREF(__pyx_v_lex_i);
- PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_lex_i);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_lex_i);
__Pyx_GIVEREF(__pyx_v_lex_i);
__Pyx_INCREF(__pyx_v_lex_j);
- PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_lex_j);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_lex_j);
__Pyx_GIVEREF(__pyx_v_lex_j);
- __pyx_t_7 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- goto __pyx_L8;
+ __pyx_t_6 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L15;
}
- __pyx_L8:;
+ __pyx_L15:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174
+ /* "cdec/sa/rulefactory.pxi":2186
* if wc > 0:
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms) # <<<<<<<<<<<<<<
* syms.pop()
*
*/
- __pyx_t_2 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+ __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_3, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_5, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_2, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_4, __pyx_v_syms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175
+ /* "cdec/sa/rulefactory.pxi":2187
* phrases.add((f, lex_i, lex_j))
* extract(f_i, f_j + 1, lex_i, lex_j, wc, ntc + 1, syms)
* syms.pop() # <<<<<<<<<<<<<<
*
* # Try to extract phrases from every f index
*/
- __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L7;
+ __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ goto __pyx_L11;
}
- __pyx_L7:;
- goto __pyx_L6;
+ __pyx_L11:;
+ goto __pyx_L10;
}
- __pyx_L6:;
+ __pyx_L10:;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
+ /* "cdec/sa/rulefactory.pxi":2162
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
@@ -67693,10 +72252,10 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -67708,7 +72267,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+/* "cdec/sa/rulefactory.pxi":2157
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
@@ -67717,7 +72276,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phras
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phrases(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *__pyx_cur_scope;
long __pyx_v_f_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
@@ -67731,7 +72290,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_f_phrases", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -67744,7 +72303,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147
+ /* "cdec/sa/rulefactory.pxi":2159
* def get_f_phrases(self, f_words):
*
* f_len = len(f_words) # <<<<<<<<<<<<<<
@@ -67753,37 +72312,37 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
*/
__pyx_t_1 = __pyx_cur_scope->__pyx_v_f_words;
__Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_cur_scope->__pyx_v_f_len = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2148
+ /* "cdec/sa/rulefactory.pxi":2160
*
* f_len = len(f_words)
* phrases = set() # (fphrase, lex_i, lex_j) # <<<<<<<<<<<<<<
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms):
*/
- __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_phrases = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
+ /* "cdec/sa/rulefactory.pxi":2162
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, 0, __pyx_n_s_get_f_phrases_locals_extract, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec_sa__sa, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, 0, __pyx_n_s_get_f_phrases_locals_extract, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cdec_sa__sa, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_v_extract = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2178
+ /* "cdec/sa/rulefactory.pxi":2190
*
* # Try to extract phrases from every f index
* for f_i from 0 <= f_i < f_len: # <<<<<<<<<<<<<<
@@ -67793,22 +72352,22 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__pyx_t_2 = __pyx_cur_scope->__pyx_v_f_len;
for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_2; __pyx_v_f_i++) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2179
+ /* "cdec/sa/rulefactory.pxi":2191
* # Try to extract phrases from every f index
* for f_i from 0 <= f_i < f_len:
* extract(f_i, f_i, f_len, -1, 0, 0, []) # <<<<<<<<<<<<<<
*
* return phrases
*/
- __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_f_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_f_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_f_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_3, __pyx_t_4, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_3, __pyx_t_4, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
@@ -67817,7 +72376,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2181
+ /* "cdec/sa/rulefactory.pxi":2193
* extract(f_i, f_i, f_len, -1, 0, 0, [])
*
* return phrases # <<<<<<<<<<<<<<
@@ -67829,7 +72388,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
__pyx_r = __pyx_cur_scope->__pyx_v_phrases;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2145
+ /* "cdec/sa/rulefactory.pxi":2157
* # (Used for EGivenFCoherent)
* # Return set of (fphrase, lex_i, lex_j)
* def get_f_phrases(self, f_words): # <<<<<<<<<<<<<<
@@ -67853,7 +72412,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2184
+/* "cdec/sa/rulefactory.pxi":2196
*
* # Drop online stats for a context
* def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<<
@@ -67892,7 +72451,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(Py
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
@@ -67905,7 +72464,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(Py
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("drop_ctx", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("drop_ctx", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -67924,35 +72483,52 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("drop_ctx", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2185
+ /* "cdec/sa/rulefactory.pxi":2197
* # Drop online stats for a context
* def drop_ctx(self, ctx_name=None):
* self.online_stats.pop(ctx_name, None) # <<<<<<<<<<<<<<
*
* # Spans are _inclusive_ on both ends [i, j]
*/
- __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->online_stats, __pyx_n_s_pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->online_stats, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = NULL;
+ __pyx_t_4 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_4 = 1;
+ }
+ }
+ __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_v_ctx_name);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ctx_name);
+ PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_ctx_name);
__Pyx_GIVEREF(__pyx_v_ctx_name);
__Pyx_INCREF(Py_None);
- PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
+ PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
__Pyx_GIVEREF(Py_None);
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2184
+ /* "cdec/sa/rulefactory.pxi":2196
*
* # Drop online stats for a context
* def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<<
@@ -67967,6 +72543,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
@@ -67975,7 +72552,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188
+/* "cdec/sa/rulefactory.pxi":2200
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
@@ -67985,7 +72562,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(st
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_17span_check = {__Pyx_NAMESTR("span_check"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_17span_check, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_17span_check = {"span_check", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_17span_check, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vec = 0;
PyObject *__pyx_v_i = 0;
@@ -68017,16 +72594,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_check") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_check") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -68041,7 +72618,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -68065,7 +72642,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_check", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2189
+ /* "cdec/sa/rulefactory.pxi":2201
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -68075,7 +72652,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190
+ /* "cdec/sa/rulefactory.pxi":2202
* def span_check(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -68083,25 +72660,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
* return False
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __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[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191
+ /* "cdec/sa/rulefactory.pxi":2203
* k = i
* while k <= j:
* if vec[k]: # <<<<<<<<<<<<<<
* return False
* k += 1
*/
- __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __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[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192
+ /* "cdec/sa/rulefactory.pxi":2204
* while k <= j:
* if vec[k]:
* return False # <<<<<<<<<<<<<<
@@ -68114,20 +72691,20 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
goto __pyx_L0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193
+ /* "cdec/sa/rulefactory.pxi":2205
* if vec[k]:
* return False
* k += 1 # <<<<<<<<<<<<<<
* return True
*
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194
+ /* "cdec/sa/rulefactory.pxi":2206
* return False
* k += 1
* return True # <<<<<<<<<<<<<<
@@ -68139,7 +72716,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
__pyx_r = Py_True;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188
+ /* "cdec/sa/rulefactory.pxi":2200
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
@@ -68159,7 +72736,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
+/* "cdec/sa/rulefactory.pxi":2208
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
@@ -68169,7 +72746,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_19span_inc = {__Pyx_NAMESTR("span_inc"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_19span_inc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_19span_inc = {"span_inc", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_19span_inc, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vec = 0;
PyObject *__pyx_v_i = 0;
@@ -68201,16 +72778,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_inc") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_inc") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -68225,7 +72802,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -68251,7 +72828,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_inc", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2197
+ /* "cdec/sa/rulefactory.pxi":2209
*
* def span_inc(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -68261,7 +72838,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198
+ /* "cdec/sa/rulefactory.pxi":2210
* def span_inc(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -68269,12 +72846,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
* k += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __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[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2210; __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[8]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2199
+ /* "cdec/sa/rulefactory.pxi":2211
* k = i
* while k <= j:
* vec[k] += 1 # <<<<<<<<<<<<<<
@@ -68283,29 +72860,29 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
*/
__Pyx_INCREF(__pyx_v_k);
__pyx_t_1 = __pyx_v_k;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2199; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200
+ /* "cdec/sa/rulefactory.pxi":2212
* while k <= j:
* vec[k] += 1
* k += 1 # <<<<<<<<<<<<<<
*
* def span_dec(vec, i, j):
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
+ /* "cdec/sa/rulefactory.pxi":2208
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
@@ -68329,7 +72906,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
+/* "cdec/sa/rulefactory.pxi":2214
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
@@ -68339,7 +72916,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py
/* Python wrapper */
static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_21span_dec = {__Pyx_NAMESTR("span_dec"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_21span_dec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_21span_dec = {"span_dec", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_21span_dec, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_vec = 0;
PyObject *__pyx_v_i = 0;
@@ -68371,16 +72948,16 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_dec") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "span_dec") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
goto __pyx_L5_argtuple_error;
@@ -68395,7 +72972,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
@@ -68421,7 +72998,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("span_dec", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2203
+ /* "cdec/sa/rulefactory.pxi":2215
*
* def span_dec(vec, i, j):
* k = i # <<<<<<<<<<<<<<
@@ -68431,7 +73008,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
__Pyx_INCREF(__pyx_v_i);
__pyx_v_k = __pyx_v_i;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204
+ /* "cdec/sa/rulefactory.pxi":2216
* def span_dec(vec, i, j):
* k = i
* while k <= j: # <<<<<<<<<<<<<<
@@ -68439,12 +73016,12 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
* k += 1
*/
while (1) {
- __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __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[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_v_j, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2216; __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[8]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_2) break;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2205
+ /* "cdec/sa/rulefactory.pxi":2217
* k = i
* while k <= j:
* vec[k] -= 1 # <<<<<<<<<<<<<<
@@ -68452,27 +73029,27 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
*/
__Pyx_INCREF(__pyx_v_k);
__pyx_t_1 = __pyx_v_k;
- __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (unlikely(PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206
+ /* "cdec/sa/rulefactory.pxi":2218
* while k <= j:
* vec[k] -= 1
* k += 1 # <<<<<<<<<<<<<<
*/
- __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_k, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
__pyx_t_1 = 0;
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
+ /* "cdec/sa/rulefactory.pxi":2214
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
@@ -68496,7 +73073,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":7
+/* "cdec/sa/features.pxi":7
*
* cdef class FeatureVector:
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -68531,7 +73108,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4c
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":8
+ /* "cdec/sa/features.pxi":8
* cdef class FeatureVector:
* def __cinit__(self):
* self.names = IntList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<<
@@ -68559,7 +73136,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4c
__pyx_v_self->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2);
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":9
+ /* "cdec/sa/features.pxi":9
* def __cinit__(self):
* self.names = IntList(INITIAL_CAPACITY, INCREMENT)
* self.values = FloatList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<<
@@ -68587,7 +73164,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4c
__pyx_v_self->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_3);
__pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":7
+ /* "cdec/sa/features.pxi":7
*
* cdef class FeatureVector:
* def __cinit__(self): # <<<<<<<<<<<<<<
@@ -68609,7 +73186,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4c
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":11
+/* "cdec/sa/features.pxi":11
* self.values = FloatList(INITIAL_CAPACITY, INCREMENT)
*
* def set(self, unsigned name, float value): # <<<<<<<<<<<<<<
@@ -68688,7 +73265,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("set", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":12
+ /* "cdec/sa/features.pxi":12
*
* def set(self, unsigned name, float value):
* self.names.append(name) # <<<<<<<<<<<<<<
@@ -68700,7 +73277,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4
__pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->names), __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":13
+ /* "cdec/sa/features.pxi":13
* def set(self, unsigned name, float value):
* self.names.append(name)
* self.values.append(value) # <<<<<<<<<<<<<<
@@ -68712,7 +73289,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4
__pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->values), __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":11
+ /* "cdec/sa/features.pxi":11
* self.values = FloatList(INITIAL_CAPACITY, INCREMENT)
*
* def set(self, unsigned name, float value): # <<<<<<<<<<<<<<
@@ -68732,9 +73309,9 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":15
+/* "cdec/sa/features.pxi":15
* self.values.append(value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -68756,14 +73333,14 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__p
}
static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__iter__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -68773,28 +73350,25 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(struct __pyx_
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator6, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_FeatureVector___iter); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
int __pyx_t_1;
unsigned int __pyx_t_2;
@@ -68817,7 +73391,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_Gener
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":17
+ /* "cdec/sa/features.pxi":17
* def __iter__(self):
* cdef unsigned i
* for i in range(self.names.len): # <<<<<<<<<<<<<<
@@ -68828,7 +73402,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_Gener
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_cur_scope->__pyx_v_i = __pyx_t_2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":18
+ /* "cdec/sa/features.pxi":18
* cdef unsigned i
* for i in range(self.names.len):
* yield (FD.word(self.names[i]), self.values[i]) # <<<<<<<<<<<<<<
@@ -68866,7 +73440,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_Gener
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":15
+ /* "cdec/sa/features.pxi":15
* self.values.append(value)
*
* def __iter__(self): # <<<<<<<<<<<<<<
@@ -68890,7 +73464,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_Gener
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":20
+/* "cdec/sa/features.pxi":20
* yield (FD.word(self.names[i]), self.values[i])
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -68910,9 +73484,9 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__py
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":21
+/* "cdec/sa/features.pxi":21
*
* def __str__(self):
* return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<<
@@ -68921,45 +73495,42 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(_
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("genexpr", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_cur_scope);
- __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *) __pyx_self;
+ __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *) __pyx_self;
__Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
{
- __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator18, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_str___locals_genexpr); if (unlikely(!gen)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
- __pyx_L0:;
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
-static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
+static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)__pyx_generator->closure);
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)__pyx_generator->closure);
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
Py_ssize_t __pyx_t_2;
@@ -68980,29 +73551,31 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(_
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
- if (PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self))) {
+ if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self))) {
__pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -69057,7 +73630,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(_
return NULL;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":20
+/* "cdec/sa/features.pxi":20
* yield (FD.word(self.names[i]), self.values[i])
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -69066,7 +73639,7 @@ static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_7__str___2generator17(_
*/
static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_cur_scope;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
@@ -69075,7 +73648,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_o
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
- __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, __pyx_empty_tuple, NULL);
+ __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29___str__, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__Pyx_RefNannyFinishContext();
return NULL;
@@ -69085,7 +73658,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_o
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":21
+ /* "cdec/sa/features.pxi":21
*
* def __str__(self):
* return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<<
@@ -69102,7 +73675,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_o
__pyx_t_2 = 0;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":20
+ /* "cdec/sa/features.pxi":20
* yield (FD.word(self.names[i]), self.values[i])
*
* def __str__(self): # <<<<<<<<<<<<<<
@@ -69123,7 +73696,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_o
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":25
+/* "cdec/sa/features.pxi":25
* cdef class Scorer:
* cdef models
* def __init__(self, *models): # <<<<<<<<<<<<<<
@@ -69159,12 +73732,13 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
Py_ssize_t __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
char *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__init__", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":26
+ /* "cdec/sa/features.pxi":26
* cdef models
* def __init__(self, *models):
* names = [FD.index(<char *>model.__name__) for model in models] # <<<<<<<<<<<<<<
@@ -69186,17 +73760,17 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_4cdec_2sa_3_sa_FD->__pyx_vtab)->index(__pyx_v_4cdec_2sa_3_sa_FD, ((char *)__pyx_t_5))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_4cdec_2sa_3_sa_FD->__pyx_vtab)->index(__pyx_v_4cdec_2sa_3_sa_FD, ((char *)__pyx_t_5))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_names = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":27
+ /* "cdec/sa/features.pxi":27
* def __init__(self, *models):
* names = [FD.index(<char *>model.__name__) for model in models]
* self.models = zip(names, models) # <<<<<<<<<<<<<<
@@ -69220,7 +73794,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
__pyx_v_self->models = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":25
+ /* "cdec/sa/features.pxi":25
* cdef class Scorer:
* cdef models
* def __init__(self, *models): # <<<<<<<<<<<<<<
@@ -69235,6 +73809,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("cdec.sa._sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
@@ -69244,7 +73819,7 @@ static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3
return __pyx_r;
}
-/* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":29
+/* "cdec/sa/features.pxi":29
* self.models = zip(names, models)
*
* cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<<
@@ -69266,12 +73841,15 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ Py_ssize_t __pyx_t_11;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("score", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":30
+ /* "cdec/sa/features.pxi":30
*
* cdef FeatureVector score(self, ctx):
* cdef FeatureVector scores = FeatureVector() # <<<<<<<<<<<<<<
@@ -69283,36 +73861,38 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":31
+ /* "cdec/sa/features.pxi":31
* cdef FeatureVector score(self, ctx):
* cdef FeatureVector scores = FeatureVector()
* for name, model in self.models: # <<<<<<<<<<<<<<
* scores.set(name, model(ctx))
* return scores
*/
- if (PyList_CheckExact(__pyx_v_self->models) || PyTuple_CheckExact(__pyx_v_self->models)) {
+ if (likely(PyList_CheckExact(__pyx_v_self->models)) || PyTuple_CheckExact(__pyx_v_self->models)) {
__pyx_t_1 = __pyx_v_self->models; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->models); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
+ __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
for (;;) {
- if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
+ if (likely(!__pyx_t_3)) {
+ if (likely(PyList_CheckExact(__pyx_t_1))) {
+ if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ } else {
+ if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+ #if CYTHON_COMPILING_IN_CPYTHON
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #else
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ #endif
+ }
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
@@ -69380,39 +73960,80 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
__Pyx_XDECREF_SET(__pyx_v_model, __pyx_t_6);
__pyx_t_6 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":32
+ /* "cdec/sa/features.pxi":32
* cdef FeatureVector scores = FeatureVector()
* for name, model in self.models:
* scores.set(name, model(ctx)) # <<<<<<<<<<<<<<
* return scores
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_scores), __pyx_n_s_set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_INCREF(__pyx_v_ctx);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_ctx);
- __Pyx_GIVEREF(__pyx_v_ctx);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_model, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_scores), __pyx_n_s_set); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
+ __Pyx_INCREF(__pyx_v_model);
+ __pyx_t_7 = __pyx_v_model; __pyx_t_9 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
+ if (likely(__pyx_t_9)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
+ __Pyx_INCREF(__pyx_t_9);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_7, function);
+ }
+ }
+ if (!__pyx_t_9) {
+ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_ctx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ } else {
+ __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
+ __Pyx_INCREF(__pyx_v_ctx);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_ctx);
+ __Pyx_GIVEREF(__pyx_v_ctx);
+ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+ }
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __pyx_t_7 = NULL;
+ __pyx_t_11 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_11 = 1;
+ }
+ }
+ __pyx_t_10 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_10);
+ if (__pyx_t_7) {
+ PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
+ }
__Pyx_INCREF(__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_name);
+ PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_v_name);
__Pyx_GIVEREF(__pyx_v_name);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "cdec/sa/features.pxi":31
+ * cdef FeatureVector score(self, ctx):
+ * cdef FeatureVector scores = FeatureVector()
+ * for name, model in self.models: # <<<<<<<<<<<<<<
+ * scores.set(name, model(ctx))
+ * return scores
+ */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":33
+ /* "cdec/sa/features.pxi":33
* for name, model in self.models:
* scores.set(name, model(ctx))
* return scores # <<<<<<<<<<<<<<
@@ -69422,7 +74043,7 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
__pyx_r = __pyx_v_scores;
goto __pyx_L0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":29
+ /* "cdec/sa/features.pxi":29
* self.models = zip(names, models)
*
* cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<<
@@ -69437,6 +74058,8 @@ static struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_f_4cdec_2sa_3_sa_6Sc
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_9);
+ __Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("cdec.sa._sa.Scorer.score", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
@@ -69502,9 +74125,9 @@ static int __pyx_mp_ass_subscript_4cdec_2sa_3_sa_FloatList(PyObject *o, PyObject
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_FloatList[] = {
- {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read, METH_O, __Pyx_DOCSTR(0)},
+ {"append", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append, METH_O, 0},
+ {"write", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write, METH_O, 0},
+ {"read", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read, METH_O, 0},
{0, 0, 0, 0}
};
@@ -69529,7 +74152,7 @@ static PyMappingMethods __pyx_tp_as_mapping_FloatList = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.FloatList"), /*tp_name*/
+ "cdec.sa._sa.FloatList", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_FloatList, /*tp_dealloc*/
@@ -69578,9 +74201,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -69640,16 +74261,16 @@ static int __pyx_mp_ass_subscript_4cdec_2sa_3_sa_IntList(PyObject *o, PyObject *
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_IntList[] = {
- {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_5index, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("partition"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("_doquicksort"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("sort"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_28append, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_32write, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_34read, METH_O, __Pyx_DOCSTR(0)},
+ {"index", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_5index, METH_O, 0},
+ {"partition", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition, METH_VARARGS|METH_KEYWORDS, 0},
+ {"_doquicksort", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort, METH_VARARGS|METH_KEYWORDS, 0},
+ {"sort", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort, METH_NOARGS, 0},
+ {"reset", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset, METH_NOARGS, 0},
+ {"get_size", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size, METH_NOARGS, 0},
+ {"append", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_28append, METH_O, 0},
+ {"extend", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend, METH_O, 0},
+ {"write", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_32write, METH_O, 0},
+ {"read", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7IntList_34read, METH_O, 0},
{0, 0, 0, 0}
};
@@ -69674,7 +74295,7 @@ static PyMappingMethods __pyx_tp_as_mapping_IntList = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.IntList"), /*tp_name*/
+ "cdec.sa._sa.IntList", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_IntList, /*tp_dealloc*/
@@ -69723,9 +74344,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -69787,13 +74406,13 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_FeatureVector[] = {
- {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {"set", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FeatureVector = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.FeatureVector"), /*tp_name*/
+ "cdec.sa._sa.FeatureVector", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector, /*tp_dealloc*/
@@ -69842,9 +74461,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FeatureVector = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -69862,6 +74479,7 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a
if (unlikely(!o)) return 0;
p = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)o);
p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Phrase;
+ p->n_vars = Py_None; Py_INCREF(Py_None);
if (unlikely(__pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(o, a, k) < 0)) {
Py_DECREF(o); o = 0;
}
@@ -69869,11 +74487,13 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a
}
static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p = (struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)o;
#if PY_VERSION_HEX >= 0x030400a1
- if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
+ if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
+ PyObject_GC_UnTrack(o);
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
@@ -69882,8 +74502,27 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase(PyObject *o) {
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
+ Py_CLEAR(p->n_vars);
(*Py_TYPE(o)->tp_free)(o);
}
+
+static int __pyx_tp_traverse_4cdec_2sa_3_sa_Phrase(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p = (struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)o;
+ if (p->n_vars) {
+ e = (*v)(p->n_vars, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_4cdec_2sa_3_sa_Phrase(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p = (struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)o;
+ tmp = ((PyObject*)p->n_vars);
+ p->n_vars = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_Phrase(PyObject *o, Py_ssize_t i) {
PyObject *r;
PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
@@ -69897,14 +74536,15 @@ static PyObject *__pyx_getprop_4cdec_2sa_3_sa_6Phrase_words(PyObject *o, CYTHON_
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Phrase[] = {
- {__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_6Phrase_6handle)},
- {__Pyx_NAMESTR("strhandle"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("getvarpos"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("getvar"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("clen"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("getchunk"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("subst"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {"handle", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle, METH_NOARGS, __pyx_doc_4cdec_2sa_3_sa_6Phrase_6handle},
+ {"strhandle", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle, METH_NOARGS, 0},
+ {"arity", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity, METH_NOARGS, 0},
+ {"getvarpos", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos, METH_O, 0},
+ {"getvar", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar, METH_O, 0},
+ {"clen", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen, METH_O, 0},
+ {"getchunk", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk, METH_O, 0},
+ {"subst", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst, METH_VARARGS|METH_KEYWORDS, 0},
+ {"iterspans", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6Phrase_34iterspans, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_2sa_3_sa_6Phrase_33iterspans},
{0, 0, 0, 0}
};
@@ -69934,7 +74574,7 @@ static PyMappingMethods __pyx_tp_as_mapping_Phrase = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Phrase"), /*tp_name*/
+ "cdec.sa._sa.Phrase", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase, /*tp_dealloc*/
@@ -69956,10 +74596,10 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa_Phrase, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa_Phrase, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__, /*tp_iter*/
@@ -69983,9 +74623,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70071,9 +74709,9 @@ static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Rule[] = {
- {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("alignments"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {"fmerge", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge, METH_O, 0},
+ {"arity", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity, METH_NOARGS, 0},
+ {"alignments", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments, METH_NOARGS, 0},
{0, 0, 0, 0}
};
@@ -70085,7 +74723,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Rule[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Rule"), /*tp_name*/
+ "cdec.sa._sa.Rule", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Rule, /*tp_dealloc*/
@@ -70134,9 +74772,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70183,7 +74819,7 @@ static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_StringMap[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.StringMap"), /*tp_name*/
+ "cdec.sa._sa.StringMap", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_StringMap), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_StringMap, /*tp_dealloc*/
@@ -70232,9 +74868,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70394,18 +75028,18 @@ static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, PyObj
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_DataArray[] = {
- {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_sentence_bounds"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_bitext"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_text_data"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced, METH_O, __Pyx_DOCSTR(0)},
+ {"get_sentence_id", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id, METH_O, 0},
+ {"get_sentence", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence, METH_O, 0},
+ {"get_id", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id, METH_O, 0},
+ {"get_sentence_bounds", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds, METH_O, 0},
+ {"write_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text, METH_O, 0},
+ {"read_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text, METH_O, 0},
+ {"read_bitext", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext, METH_VARARGS|METH_KEYWORDS, 0},
+ {"read_text_data", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data, METH_O, 0},
+ {"read_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary, METH_O, 0},
+ {"write_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary, METH_O, 0},
+ {"write_enhanced_handle", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle, METH_O, 0},
+ {"write_enhanced", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced, METH_O, 0},
{0, 0, 0, 0}
};
@@ -70439,7 +75073,7 @@ static PyMappingMethods __pyx_tp_as_mapping_DataArray = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.DataArray"), /*tp_name*/
+ "cdec.sa._sa.DataArray", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_DataArray), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_DataArray, /*tp_dealloc*/
@@ -70488,9 +75122,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70554,20 +75186,20 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_Alignment(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Alignment[] = {
- {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_9Alignment_unlink)},
- {__Pyx_NAMESTR("get_sent_links"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("alignment"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_9Alignment_16alignment)},
+ {"unlink", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink, METH_O, __pyx_doc_4cdec_2sa_3_sa_9Alignment_unlink},
+ {"get_sent_links", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links, METH_O, 0},
+ {"read_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text, METH_O, 0},
+ {"read_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary, METH_O, 0},
+ {"write_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text, METH_O, 0},
+ {"write_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary, METH_O, 0},
+ {"write_enhanced", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced, METH_O, 0},
+ {"alignment", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment, METH_O, __pyx_doc_4cdec_2sa_3_sa_9Alignment_16alignment},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alignment = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Alignment"), /*tp_name*/
+ "cdec.sa._sa.Alignment", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alignment), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment, /*tp_dealloc*/
@@ -70616,9 +75248,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alignment = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70730,22 +75360,22 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_BiLex(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_BiLex[] = {
- {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("contains_e_word"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7contains_e_word, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("contains_f_word"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9contains_f_word, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11get_e_id, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13get_f_id, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_20write_text)},
+ {"write_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary, METH_O, 0},
+ {"read_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary, METH_O, 0},
+ {"contains_e_word", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7contains_e_word, METH_O, 0},
+ {"contains_f_word", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9contains_f_word, METH_O, 0},
+ {"get_e_id", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11get_e_id, METH_O, 0},
+ {"get_f_id", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13get_f_id, METH_O, 0},
+ {"read_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15read_text, METH_O, 0},
+ {"write_enhanced", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_enhanced, METH_O, 0},
+ {"get_score", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_19get_score, METH_VARARGS|METH_KEYWORDS, 0},
+ {"write_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_21write_text, METH_O, __pyx_doc_4cdec_2sa_3_sa_5BiLex_20write_text},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BiLex = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.BiLex"), /*tp_name*/
+ "cdec.sa._sa.BiLex", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BiLex), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex, /*tp_dealloc*/
@@ -70794,9 +75424,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BiLex = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70823,13 +75451,13 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_BitSetIterator[] = {
- {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
+ {"__next__", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__, METH_NOARGS|METH_COEXIST, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSetIterator = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.BitSetIterator"), /*tp_name*/
+ "cdec.sa._sa.BitSetIterator", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator, /*tp_dealloc*/
@@ -70878,9 +75506,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSetIterator = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -70918,10 +75544,10 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_BitSet[] = {
- {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("min"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("max"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max, METH_NOARGS, __Pyx_DOCSTR(0)},
+ {"insert", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert, METH_O, 0},
+ {"findsucc", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc, METH_O, 0},
+ {"min", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min, METH_NOARGS, 0},
+ {"max", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max, METH_NOARGS, 0},
{0, 0, 0, 0}
};
@@ -70946,7 +75572,7 @@ static PyMappingMethods __pyx_tp_as_mapping_BitSet = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.BitSet"), /*tp_name*/
+ "cdec.sa._sa.BitSet", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSet), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet, /*tp_dealloc*/
@@ -70995,9 +75621,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71024,13 +75648,13 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_VEBIterator[] = {
- {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)},
+ {"__next__", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__, METH_NOARGS|METH_COEXIST, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEBIterator = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.VEBIterator"), /*tp_name*/
+ "cdec.sa._sa.VEBIterator", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator, /*tp_dealloc*/
@@ -71079,9 +75703,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEBIterator = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71123,8 +75745,8 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEB(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_VEB[] = {
- {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc, METH_O, __Pyx_DOCSTR(0)},
+ {"insert", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert, METH_O, 0},
+ {"findsucc", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc, METH_O, 0},
{0, 0, 0, 0}
};
@@ -71149,7 +75771,7 @@ static PyMappingMethods __pyx_tp_as_mapping_VEB = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.VEB"), /*tp_name*/
+ "cdec.sa._sa.VEB", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEB), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_VEB, /*tp_dealloc*/
@@ -71198,9 +75820,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71262,13 +75882,13 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_LCP(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_LCP[] = {
- {__Pyx_NAMESTR("compute_stats"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_3LCP_2compute_stats)},
+ {"compute_stats", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats, METH_O, __pyx_doc_4cdec_2sa_3_sa_3LCP_2compute_stats},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_LCP = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.LCP"), /*tp_name*/
+ "cdec.sa._sa.LCP", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_LCP), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_LCP, /*tp_dealloc*/
@@ -71317,9 +75937,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_LCP = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71418,7 +76036,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Alphabet[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Alphabet"), /*tp_name*/
+ "cdec.sa._sa.Alphabet", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Alphabet, /*tp_dealloc*/
@@ -71467,9 +76085,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71511,15 +76127,15 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieMap[] = {
- {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("toMap"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap, METH_O, __Pyx_DOCSTR(0)},
+ {"insert", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert, METH_O, 0},
+ {"contains", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains, METH_O, 0},
+ {"toMap", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap, METH_O, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieMap = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.TrieMap"), /*tp_name*/
+ "cdec.sa._sa.TrieMap", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap, /*tp_dealloc*/
@@ -71568,9 +76184,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieMap = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71634,15 +76248,15 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Precomputation[] = {
- {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {"read_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary, METH_O, 0},
+ {"write_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary, METH_O, 0},
+ {"precompute", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Precomputation = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Precomputation"), /*tp_name*/
+ "cdec.sa._sa.Precomputation", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation, /*tp_dealloc*/
@@ -71691,9 +76305,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Precomputation = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -71772,13 +76384,13 @@ static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_SuffixArray(PyObject *o, Py_ssize_
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_SuffixArray[] = {
- {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_11SuffixArray_4read_text)},
- {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_11SuffixArray_6q3sort)},
- {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {"read_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_4read_text},
+ {"q3sort", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_6q3sort},
+ {"write_text", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text, METH_O, 0},
+ {"read_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary, METH_O, 0},
+ {"write_binary", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary, METH_O, 0},
+ {"write_enhanced", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced, METH_O, 0},
+ {"lookup", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
@@ -71803,7 +76415,7 @@ static PyMappingMethods __pyx_tp_as_mapping_SuffixArray = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.SuffixArray"), /*tp_name*/
+ "cdec.sa._sa.SuffixArray", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_SuffixArray, /*tp_dealloc*/
@@ -71852,9 +76464,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72041,7 +76651,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_OnlineStats[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.OnlineStats"), /*tp_name*/
+ "cdec.sa._sa.OnlineStats", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_OnlineStats, /*tp_dealloc*/
@@ -72090,9 +76700,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72169,7 +76777,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieNode[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.TrieNode"), /*tp_name*/
+ "cdec.sa._sa.TrieNode", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode, /*tp_dealloc*/
@@ -72218,9 +76826,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72339,7 +76945,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.ExtendedTrieNode"), /*tp_name*/
+ "cdec.sa._sa.ExtendedTrieNode", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_dealloc*/
@@ -72388,9 +76994,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72497,7 +77101,7 @@ static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieTable[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.TrieTable"), /*tp_name*/
+ "cdec.sa._sa.TrieTable", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_TrieTable, /*tp_dealloc*/
@@ -72546,9 +77150,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72609,7 +77211,7 @@ static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_PhraseLocation[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.PhraseLocation"), /*tp_name*/
+ "cdec.sa._sa.PhraseLocation", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_PhraseLocation, /*tp_dealloc*/
@@ -72658,9 +77260,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72714,13 +77314,13 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_Sampler(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Sampler[] = {
- {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_7Sampler_2sample)},
+ {"sample", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample, METH_O, __pyx_doc_4cdec_2sa_3_sa_7Sampler_2sample},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Sampler = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Sampler"), /*tp_name*/
+ "cdec.sa._sa.Sampler", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Sampler), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler, /*tp_dealloc*/
@@ -72743,7 +77343,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Sampler = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- __Pyx_DOCSTR("A Sampler implements a logic for choosing\n samples from a population range"), /*tp_doc*/
+ "A Sampler implements a logic for choosing\n samples from a population range", /*tp_doc*/
__pyx_tp_traverse_4cdec_2sa_3_sa_Sampler, /*tp_traverse*/
__pyx_tp_clear_4cdec_2sa_3_sa_Sampler, /*tp_clear*/
0, /*tp_richcompare*/
@@ -72769,9 +77369,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Sampler = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -72963,29 +77561,29 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) {
}
static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_HieroCachingRuleFactory[] = {
- {__Pyx_NAMESTR("configure"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure)},
- {__Pyx_NAMESTR("pattern2phrase"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("pattern2phrase_plus"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute, METH_NOARGS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_precomputed_collocation"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("advance"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_all_nodes_isteps_away"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("reachable"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("shortest"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input)},
- {__Pyx_NAMESTR("add_instance"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("form_rule"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("fmt_rule"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("online_ctx_lookup"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("get_f_phrases"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases, METH_O, __Pyx_DOCSTR(0)},
- {__Pyx_NAMESTR("drop_ctx"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
+ {"configure", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure},
+ {"pattern2phrase", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase, METH_O, 0},
+ {"pattern2phrase_plus", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus, METH_O, 0},
+ {"precompute", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute, METH_NOARGS, 0},
+ {"get_precomputed_collocation", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation, METH_O, 0},
+ {"advance", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance, METH_VARARGS|METH_KEYWORDS, 0},
+ {"get_all_nodes_isteps_away", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, 0},
+ {"reachable", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable, METH_VARARGS|METH_KEYWORDS, 0},
+ {"shortest", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest, METH_VARARGS|METH_KEYWORDS, 0},
+ {"get_next_states", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, 0},
+ {"input", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input},
+ {"add_instance", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance, METH_VARARGS|METH_KEYWORDS, 0},
+ {"form_rule", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule, METH_VARARGS|METH_KEYWORDS, 0},
+ {"fmt_rule", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule, METH_VARARGS|METH_KEYWORDS, 0},
+ {"online_ctx_lookup", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup, METH_VARARGS|METH_KEYWORDS, 0},
+ {"get_f_phrases", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases, METH_O, 0},
+ {"drop_ctx", (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.HieroCachingRuleFactory"), /*tp_name*/
+ "cdec.sa._sa.HieroCachingRuleFactory", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_dealloc*/
@@ -73008,7 +77606,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- __Pyx_DOCSTR("This RuleFactory implements a caching \n method using TrieTable, which makes phrase\n generation somewhat speedier -- phrases only\n need to be extracted once (however, it is\n quite possible they need to be scored \n for each input sentence, for contextual models)"), /*tp_doc*/
+ "This RuleFactory implements a caching \n method using TrieTable, which makes phrase\n generation somewhat speedier -- phrases only\n need to be extracted once (however, it is\n quite possible they need to be scored \n for each input sentence, for contextual models)", /*tp_doc*/
__pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_traverse*/
__pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_clear*/
0, /*tp_richcompare*/
@@ -73034,9 +77632,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73094,7 +77690,7 @@ static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Scorer[] = {
static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.Scorer"), /*tp_name*/
+ "cdec.sa._sa.Scorer", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Scorer), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa_Scorer, /*tp_dealloc*/
@@ -73143,9 +77739,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73156,7 +77750,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__));
(void) PyObject_INIT(o, t);
@@ -73172,7 +77766,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObjec
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73199,7 +77793,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct____iter__"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct____iter__", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_dealloc*/
@@ -73248,9 +77842,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73261,7 +77853,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext));
(void) PyObject_INIT(o, t);
@@ -73277,7 +77869,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyO
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_fp);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73304,7 +77896,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObje
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_1_read_bitext"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_1_read_bitext", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_dealloc*/
@@ -73353,9 +77945,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73366,7 +77956,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr));
(void) PyObject_INIT(o, t);
@@ -73384,7 +77974,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObjec
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_line);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73423,7 +78013,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_2_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_2_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
@@ -73472,9 +78062,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73485,7 +78073,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = 0
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats));
(void) PyObject_INIT(o, t);
@@ -73506,7 +78094,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(P
Py_CLEAR(p->__pyx_v_run_start);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_v_veb);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73563,7 +78151,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyOb
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_3_compute_stats"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_3_compute_stats", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_dealloc*/
@@ -73612,9 +78200,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73625,7 +78211,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice));
(void) PyObject_INIT(o, t);
@@ -73642,7 +78228,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(Py
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_word_ids);
Py_CLEAR(p->__pyx_v_words);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73675,7 +78261,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObj
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_4_make_lattice"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_4_make_lattice", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_dealloc*/
@@ -73724,9 +78310,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73737,7 +78321,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr));
(void) PyObject_INIT(o, t);
@@ -73755,7 +78339,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObjec
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_word);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73794,7 +78378,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_5_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_5_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_dealloc*/
@@ -73843,9 +78427,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73856,7 +78438,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr));
(void) PyObject_INIT(o, t);
@@ -73874,7 +78456,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObjec
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_word);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -73913,7 +78495,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_6_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_6_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
@@ -73962,9 +78544,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -73975,7 +78555,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice =
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice));
(void) PyObject_INIT(o, t);
@@ -73991,7 +78571,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_lattice);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74018,7 +78598,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyO
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_7_decode_lattice"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_7_decode_lattice", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_dealloc*/
@@ -74067,9 +78647,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattic
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74080,7 +78658,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr));
(void) PyObject_INIT(o, t);
@@ -74104,7 +78682,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObjec
Py_CLEAR(p->__pyx_t_0);
Py_CLEAR(p->__pyx_t_3);
Py_CLEAR(p->__pyx_t_4);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74179,7 +78757,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_8_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_8_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_dealloc*/
@@ -74228,9 +78806,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74241,7 +78817,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence =
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence));
(void) PyObject_INIT(o, t);
@@ -74257,7 +78833,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_lattice);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74284,7 +78860,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(Py
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_9_decode_sentence"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_9_decode_sentence", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_dealloc*/
@@ -74333,9 +78909,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_senten
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74346,7 +78920,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr));
(void) PyObject_INIT(o, t);
@@ -74365,7 +78939,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObje
Py_CLEAR(p->__pyx_v__);
Py_CLEAR(p->__pyx_v_sym);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74410,7 +78984,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_10_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_10_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_dealloc*/
@@ -74459,9 +79033,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74472,7 +79044,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = 0
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words));
(void) PyObject_INIT(o, t);
@@ -74488,7 +79060,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(P
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_words);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74515,7 +79087,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyOb
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_11_encode_words"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_11_encode_words", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_dealloc*/
@@ -74564,9 +79136,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74577,7 +79147,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr));
(void) PyObject_INIT(o, t);
@@ -74595,7 +79165,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObje
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_word);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74634,7 +79204,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_12_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_12_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_dealloc*/
@@ -74683,9 +79253,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74696,7 +79264,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = 0
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words));
(void) PyObject_INIT(o, t);
@@ -74712,7 +79280,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(P
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_syms);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74739,7 +79307,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyOb
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_13_decode_words"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_13_decode_words", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_dealloc*/
@@ -74788,9 +79356,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74801,7 +79367,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr));
(void) PyObject_INIT(o, t);
@@ -74819,7 +79385,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObje
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_sym);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74858,7 +79424,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_14_genexpr"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_14_genexpr", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_dealloc*/
@@ -74907,9 +79473,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -74920,7 +79484,7 @@ static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = 0;
static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__)))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__)))) {
o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__];
memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__));
(void) PyObject_INIT(o, t);
@@ -74936,7 +79500,7 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObj
struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__))) {
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__)))) {
__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
@@ -74963,7 +79527,7 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject
static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_15___iter__"), /*tp_name*/
+ "cdec.sa._sa.__pyx_scope_struct_15___iter__", /*tp_name*/
sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_dealloc*/
@@ -75012,22 +79576,151 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
+ #if PY_VERSION_HEX >= 0x030400a1
+ 0, /*tp_finalize*/
+ #endif
+};
+
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans = 0;
+
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+ PyObject *o;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans));
+ (void) PyObject_INIT(o, t);
+ PyObject_GC_Track(o);
+ } else {
+ o = (*t->tp_alloc)(t, 0);
+ if (unlikely(!o)) return 0;
+ }
+ return o;
+}
+
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)o;
+ PyObject_GC_UnTrack(o);
+ Py_CLEAR(p->__pyx_v_get_sym);
+ Py_CLEAR(p->__pyx_v_nt_flag);
+ Py_CLEAR(p->__pyx_v_self);
+ Py_CLEAR(p->__pyx_v_span);
+ Py_CLEAR(p->__pyx_v_to_str);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)o);
+ } else {
+ (*Py_TYPE(o)->tp_free)(o);
+ }
+}
+
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(PyObject *o, visitproc v, void *a) {
+ int e;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)o;
+ if (p->__pyx_v_get_sym) {
+ e = (*v)(p->__pyx_v_get_sym, a); if (e) return e;
+ }
+ if (p->__pyx_v_nt_flag) {
+ e = (*v)(p->__pyx_v_nt_flag, a); if (e) return e;
+ }
+ if (p->__pyx_v_self) {
+ e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
+ }
+ if (p->__pyx_v_span) {
+ e = (*v)(p->__pyx_v_span, a); if (e) return e;
+ }
+ if (p->__pyx_v_to_str) {
+ e = (*v)(p->__pyx_v_to_str, a); if (e) return e;
+ }
+ return 0;
+}
+
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans(PyObject *o) {
+ PyObject* tmp;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans *)o;
+ tmp = ((PyObject*)p->__pyx_v_get_sym);
+ p->__pyx_v_get_sym = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_nt_flag);
+ p->__pyx_v_nt_flag = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_self);
+ p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_span);
+ p->__pyx_v_span = ((PyObject*)Py_None); Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ tmp = ((PyObject*)p->__pyx_v_to_str);
+ p->__pyx_v_to_str = Py_None; Py_INCREF(Py_None);
+ Py_XDECREF(tmp);
+ return 0;
+}
+
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans = {
+ PyVarObject_HEAD_INIT(0, 0)
+ "cdec.sa._sa.__pyx_scope_struct_16_iterspans", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ #if PY_MAJOR_VERSION < 3
+ 0, /*tp_compare*/
+ #else
+ 0, /*reserved*/
#endif
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+ 0, /*tp_doc*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ 0, /*tp_methods*/
+ 0, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17___str__[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16___str__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17___str__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17___str__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -75037,41 +79730,41 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_16___str__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17___str__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17___str__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17___str__(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_16___str__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_17___str__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17___str__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75092,8 +79785,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17___str__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17___str__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -75108,7 +79801,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17___str__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75117,22 +79810,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -75142,22 +79833,22 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_a);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -75170,11 +79861,11 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObje
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr *)o;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_a);
p->__pyx_v_a = Py_None; Py_INCREF(Py_None);
@@ -75185,12 +79876,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_17_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_18_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75211,8 +79902,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -75227,7 +79918,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75236,22 +79927,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -75261,22 +79950,22 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(Py
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_point);
Py_CLEAR(p->__pyx_v_self);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)o;
if (p->__pyx_v_point) {
e = (*v)(p->__pyx_v_point, a); if (e) return e;
}
@@ -75289,9 +79978,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyO
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments *)o;
tmp = ((PyObject*)p->__pyx_v_point);
p->__pyx_v_point = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -75304,12 +79993,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyObje
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_18_alignments"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_19_alignments", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75330,8 +80019,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments =
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -75346,7 +80035,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75355,22 +80044,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_input[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_input = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_input[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_input = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_input > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_input[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_input];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_input > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_input[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_input];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -75380,8 +80067,8 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeO
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_input(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_alignment);
Py_CLEAR(p->__pyx_v_als);
@@ -75439,19 +80126,19 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject
Py_CLEAR(p->__pyx_v_xcat_index);
Py_CLEAR(p->__pyx_v_xnode);
Py_CLEAR(p->__pyx_v_xroot);
- Py_CLEAR(p->__pyx_t_3);
+ Py_CLEAR(p->__pyx_t_0);
Py_CLEAR(p->__pyx_t_4);
Py_CLEAR(p->__pyx_t_5);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_input < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_19_input[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_19_input++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_input < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_input[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_input++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_20_input(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)o;
if (p->__pyx_v_alignment) {
e = (*v)(p->__pyx_v_alignment, a); if (e) return e;
}
@@ -75620,8 +80307,8 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject
if (p->__pyx_v_xroot) {
e = (*v)(p->__pyx_v_xroot, a); if (e) return e;
}
- if (p->__pyx_t_3) {
- e = (*v)(p->__pyx_t_3, a); if (e) return e;
+ if (p->__pyx_t_0) {
+ e = (*v)(p->__pyx_t_0, a); if (e) return e;
}
if (p->__pyx_t_4) {
e = (*v)(p->__pyx_t_4, a); if (e) return e;
@@ -75632,9 +80319,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_input(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)o;
tmp = ((PyObject*)p->__pyx_v_alignment);
p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -75803,8 +80490,8 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject *o
tmp = ((PyObject*)p->__pyx_v_xroot);
p->__pyx_v_xroot = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
- tmp = ((PyObject*)p->__pyx_t_3);
- p->__pyx_t_3 = Py_None; Py_INCREF(Py_None);
+ tmp = ((PyObject*)p->__pyx_t_0);
+ p->__pyx_t_0 = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_t_4);
p->__pyx_t_4 = Py_None; Py_INCREF(Py_None);
@@ -75815,12 +80502,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyObject *o
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_input = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_19_input"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_20_input", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_input, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75841,8 +80528,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_20_input, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_input, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -75857,7 +80544,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_input, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75866,22 +80553,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -75891,22 +80576,22 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_word);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -75919,11 +80604,11 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyObje
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr *)o;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_input *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_word);
p->__pyx_v_word = Py_None; Py_INCREF(Py_None);
@@ -75934,12 +80619,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_20_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_21_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -75960,8 +80645,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -75976,7 +80661,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -75985,22 +80670,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76010,8 +80693,8 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_al);
Py_CLEAR(p->__pyx_v_cover);
@@ -76024,16 +80707,16 @@ static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(P
Py_CLEAR(p->__pyx_v_fe_span);
Py_CLEAR(p->__pyx_v_rules);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *)o;
if (p->__pyx_v_al) {
e = (*v)(p->__pyx_v_al, a); if (e) return e;
}
@@ -76070,9 +80753,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(P
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance *)o;
tmp = ((PyObject*)p->__pyx_v_al);
p->__pyx_v_al = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -76109,12 +80792,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyOb
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_21_add_instance"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_22_add_instance", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76135,8 +80818,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76151,7 +80834,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76160,22 +80843,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76185,21 +80866,21 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyT
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_links);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)o;
if (p->__pyx_v_links) {
e = (*v)(p->__pyx_v_links, a); if (e) return e;
}
@@ -76209,9 +80890,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyOb
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)o;
tmp = ((PyObject*)p->__pyx_v_links);
p->__pyx_v_links = ((PyObject*)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -76221,12 +80902,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyObjec
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_22_form_rule"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_23_form_rule", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76247,8 +80928,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule =
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76263,7 +80944,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule =
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76272,22 +80953,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule =
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76297,23 +80976,23 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_i);
Py_CLEAR(p->__pyx_v_j);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -76329,11 +81008,11 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObje
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr *)o;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_i);
p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
@@ -76347,12 +81026,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_23_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_24_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76373,8 +81052,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76389,7 +81068,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76398,22 +81077,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76423,21 +81100,21 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyTy
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_a);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)o;
if (p->__pyx_v_a) {
e = (*v)(p->__pyx_v_a, a); if (e) return e;
}
@@ -76447,9 +81124,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyObj
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)o;
tmp = ((PyObject*)p->__pyx_v_a);
p->__pyx_v_a = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -76459,12 +81136,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_24_fmt_rule"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_25_fmt_rule", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76485,8 +81162,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76501,7 +81178,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76510,22 +81187,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76535,22 +81210,22 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_packed);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -76563,11 +81238,11 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObje
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr *)o;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_packed);
p->__pyx_v_packed = Py_None; Py_INCREF(Py_None);
@@ -76578,12 +81253,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_25_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_26_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76604,8 +81279,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76620,7 +81295,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76629,22 +81304,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76654,23 +81327,23 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_extract);
Py_CLEAR(p->__pyx_v_f_words);
Py_CLEAR(p->__pyx_v_phrases);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *)o;
if (p->__pyx_v_extract) {
e = (*v)(p->__pyx_v_extract, a); if (e) return e;
}
@@ -76686,9 +81359,9 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases *)o;
tmp = ((PyObject*)p->__pyx_v_extract);
p->__pyx_v_extract = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
@@ -76704,12 +81377,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyO
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_26_get_f_phrases"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_27_get_f_phrases", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76730,8 +81403,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrase
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76746,7 +81419,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrase
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76755,22 +81428,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrase
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76780,41 +81451,41 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTy
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_27___iter__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_28___iter__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76835,8 +81506,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76851,7 +81522,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76860,22 +81531,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29___str__[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___str__];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29___str__[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29___str__];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76885,41 +81554,41 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_v_self);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_28___str__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29___str__[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29___str__++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)o;
if (p->__pyx_v_self) {
e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
}
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29___str__(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)o;
tmp = ((PyObject*)p->__pyx_v_self);
p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_28___str__"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_29___str__", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29___str__, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -76940,8 +81609,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29___str__, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29___str__, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -76956,7 +81625,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29___str__, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -76965,22 +81634,20 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
};
-static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr[8];
-static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = 0;
+static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr[8];
+static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr = 0;
-static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
+static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
PyObject *o;
- if (likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr)))) {
- o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr];
- memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr));
+ if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr)))) {
+ o = (PyObject*)__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr[--__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr];
+ memset(o, 0, sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr));
(void) PyObject_INIT(o, t);
PyObject_GC_Track(o);
} else {
@@ -76990,22 +81657,22 @@ static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTyp
return o;
}
-static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObject *o) {
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)o;
+static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(PyObject *o) {
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)o;
PyObject_GC_UnTrack(o);
Py_CLEAR(p->__pyx_outer_scope);
Py_CLEAR(p->__pyx_v_feat);
Py_CLEAR(p->__pyx_t_0);
- if ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr))) {
- __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)o);
+ if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr)))) {
+ __pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr[__pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr++] = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)o);
} else {
(*Py_TYPE(o)->tp_free)(o);
}
}
-static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) {
+static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(PyObject *o, visitproc v, void *a) {
int e;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)o;
if (p->__pyx_outer_scope) {
e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e;
}
@@ -77018,11 +81685,11 @@ static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObje
return 0;
}
-static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObject *o) {
+static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr(PyObject *o) {
PyObject* tmp;
- struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)o;
+ struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr *)o;
tmp = ((PyObject*)p->__pyx_outer_scope);
- p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)Py_None); Py_INCREF(Py_None);
+ p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ *)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->__pyx_v_feat);
p->__pyx_v_feat = Py_None; Py_INCREF(Py_None);
@@ -77033,12 +81700,12 @@ static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObject
return 0;
}
-static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = {
+static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cdec.sa._sa.__pyx_scope_struct_29_genexpr"), /*tp_name*/
- sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr), /*tp_basicsize*/
+ "cdec.sa._sa.__pyx_scope_struct_30_genexpr", /*tp_name*/
+ sizeof(struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr), /*tp_basicsize*/
0, /*tp_itemsize*/
- __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_dealloc*/
+ __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
@@ -77059,8 +81726,8 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = {
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
- __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_traverse*/
- __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_clear*/
+ __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr, /*tp_traverse*/
+ __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
@@ -77075,7 +81742,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = {
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
- __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_new*/
+ __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
@@ -77084,9 +81751,7 @@ static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = {
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
- #if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
- #endif
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
@@ -77103,7 +81768,7 @@ static struct PyModuleDef __pyx_moduledef = {
#else
PyModuleDef_HEAD_INIT,
#endif
- __Pyx_NAMESTR("_sa"),
+ "_sa",
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
@@ -77134,9 +81799,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
{&__pyx_kp_s_Extract_time_f_seconds, __pyx_k_Extract_time_f_seconds, sizeof(__pyx_k_Extract_time_f_seconds), 0, 0, 1, 0},
{&__pyx_n_s_FeatureContext, __pyx_k_FeatureContext, sizeof(__pyx_k_FeatureContext), 0, 0, 1, 1},
+ {&__pyx_n_s_FeatureVector___iter, __pyx_k_FeatureVector___iter, sizeof(__pyx_k_FeatureVector___iter), 0, 0, 1, 1},
{&__pyx_kp_s_Finalizing_sort, __pyx_k_Finalizing_sort, sizeof(__pyx_k_Finalizing_sort), 0, 0, 1, 0},
{&__pyx_kp_s_Gaps_are_not_tight_phrases, __pyx_k_Gaps_are_not_tight_phrases, sizeof(__pyx_k_Gaps_are_not_tight_phrases), 0, 0, 1, 0},
{&__pyx_n_s_GzipFile, __pyx_k_GzipFile, sizeof(__pyx_k_GzipFile), 0, 0, 1, 1},
+ {&__pyx_n_s_HieroCachingRuleFactory_input, __pyx_k_HieroCachingRuleFactory_input, sizeof(__pyx_k_HieroCachingRuleFactory_input), 0, 0, 1, 1},
{&__pyx_n_s_INCREMENT, __pyx_k_INCREMENT, sizeof(__pyx_k_INCREMENT), 0, 0, 1, 1},
{&__pyx_n_s_INITIAL_CAPACITY, __pyx_k_INITIAL_CAPACITY, sizeof(__pyx_k_INITIAL_CAPACITY), 0, 0, 1, 1},
{&__pyx_kp_s_Illegal_key_type_s_for_IntList, __pyx_k_Illegal_key_type_s_for_IntList, sizeof(__pyx_k_Illegal_key_type_s_for_IntList), 0, 0, 1, 0},
@@ -77144,14 +81811,18 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_Inside_edges_of_following_subphr, __pyx_k_Inside_edges_of_following_subphr, sizeof(__pyx_k_Inside_edges_of_following_subphr), 0, 0, 1, 0},
{&__pyx_kp_s_Inside_edges_of_preceding_subphr, __pyx_k_Inside_edges_of_preceding_subphr, sizeof(__pyx_k_Inside_edges_of_preceding_subphr), 0, 0, 1, 0},
{&__pyx_kp_s_IntList, __pyx_k_IntList, sizeof(__pyx_k_IntList), 0, 0, 1, 0},
+ {&__pyx_n_s_IntList___iter, __pyx_k_IntList___iter, sizeof(__pyx_k_IntList___iter), 0, 0, 1, 1},
{&__pyx_kp_s_Intersect_time_f_seconds, __pyx_k_Intersect_time_f_seconds, sizeof(__pyx_k_Intersect_time_f_seconds), 0, 0, 1, 0},
{&__pyx_kp_s_Invalid_LHS_symbol_d, __pyx_k_Invalid_LHS_symbol_d, sizeof(__pyx_k_Invalid_LHS_symbol_d), 0, 0, 1, 0},
{&__pyx_kp_s_Keyword_trie_error, __pyx_k_Keyword_trie_error, sizeof(__pyx_k_Keyword_trie_error), 0, 0, 1, 0},
{&__pyx_kp_s_LCP_array_completed, __pyx_k_LCP_array_completed, sizeof(__pyx_k_LCP_array_completed), 0, 0, 1, 0},
+ {&__pyx_n_s_LCP_compute_stats, __pyx_k_LCP_compute_stats, sizeof(__pyx_k_LCP_compute_stats), 0, 0, 1, 1},
{&__pyx_kp_s_Must_specify_an_alignment_object, __pyx_k_Must_specify_an_alignment_object, sizeof(__pyx_k_Must_specify_an_alignment_object), 0, 0, 1, 0},
{&__pyx_n_s_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 0, 0, 1, 1},
{&__pyx_kp_s_No_aligned_terminals, __pyx_k_No_aligned_terminals, sizeof(__pyx_k_No_aligned_terminals), 0, 0, 1, 0},
{&__pyx_n_s_OnlineFeatureContext, __pyx_k_OnlineFeatureContext, sizeof(__pyx_k_OnlineFeatureContext), 0, 0, 1, 1},
+ {&__pyx_n_s_Phrase___iter, __pyx_k_Phrase___iter, sizeof(__pyx_k_Phrase___iter), 0, 0, 1, 1},
+ {&__pyx_n_s_Phrase_iterspans, __pyx_k_Phrase_iterspans, sizeof(__pyx_k_Phrase_iterspans), 0, 0, 1, 1},
{&__pyx_kp_s_Precomputation_done_with_max_ini, __pyx_k_Precomputation_done_with_max_ini, sizeof(__pyx_k_Precomputation_done_with_max_ini), 0, 0, 1, 0},
{&__pyx_kp_s_Precomputation_done_with_max_non, __pyx_k_Precomputation_done_with_max_non, sizeof(__pyx_k_Precomputation_done_with_max_non), 0, 0, 1, 0},
{&__pyx_kp_s_Precomputation_done_with_max_ter, __pyx_k_Precomputation_done_with_max_ter, sizeof(__pyx_k_Precomputation_done_with_max_ter), 0, 0, 1, 0},
@@ -77169,6 +81840,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_Requested_index_d_d_of_d_length, __pyx_k_Requested_index_d_d_of_d_length, sizeof(__pyx_k_Requested_index_d_d_of_d_length), 0, 0, 1, 0},
{&__pyx_kp_s_Requested_index_d_of_d_length_Fl, __pyx_k_Requested_index_d_of_d_length_Fl, sizeof(__pyx_k_Requested_index_d_of_d_length_Fl), 0, 0, 1, 0},
{&__pyx_kp_s_Requested_index_d_of_d_length_In, __pyx_k_Requested_index_d_of_d_length_In, sizeof(__pyx_k_Requested_index_d_of_d_length_In), 0, 0, 1, 0},
+ {&__pyx_n_s_Rule_alignments, __pyx_k_Rule_alignments, sizeof(__pyx_k_Rule_alignments), 0, 0, 1, 1},
{&__pyx_kp_s_Sampling_strategy_no_sampling, __pyx_k_Sampling_strategy_no_sampling, sizeof(__pyx_k_Sampling_strategy_no_sampling), 0, 0, 1, 0},
{&__pyx_kp_s_Sampling_strategy_uniform_max_sa, __pyx_k_Sampling_strategy_uniform_max_sa, sizeof(__pyx_k_Sampling_strategy_uniform_max_sa), 0, 0, 1, 0},
{&__pyx_kp_s_Sort_error_in_CLex, __pyx_k_Sort_error_in_CLex, sizeof(__pyx_k_Sort_error_in_CLex), 0, 0, 1, 0},
@@ -77180,6 +81852,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_Unable_to_extract_basic_phrase, __pyx_k_Unable_to_extract_basic_phrase, sizeof(__pyx_k_Unable_to_extract_basic_phrase), 0, 0, 1, 0},
{&__pyx_kp_s_Unaligned_chunk, __pyx_k_Unaligned_chunk, sizeof(__pyx_k_Unaligned_chunk), 0, 0, 1, 0},
{&__pyx_kp_s_Unexpected_condition_found_in_q3, __pyx_k_Unexpected_condition_found_in_q3, sizeof(__pyx_k_Unexpected_condition_found_in_q3), 0, 0, 1, 0},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_k_Users_waziz_workspace_mtm14_my, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my), 0, 0, 1, 0},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my_2, __pyx_k_Users_waziz_workspace_mtm14_my_2, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my_2), 0, 0, 1, 0},
+ {&__pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_k_Users_waziz_workspace_mtm14_my_3, sizeof(__pyx_k_Users_waziz_workspace_mtm14_my_3), 0, 0, 1, 0},
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
{&__pyx_kp_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 0},
{&__pyx_kp_s_X_0_1_2, __pyx_k_X_0_1_2, sizeof(__pyx_k_X_0_1_2), 0, 0, 1, 0},
@@ -77223,6 +81898,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1},
{&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
{&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1},
+ {&__pyx_n_s_compute_stats, __pyx_k_compute_stats, sizeof(__pyx_k_compute_stats), 0, 0, 1, 1},
{&__pyx_n_s_ctx_name, __pyx_k_ctx_name, sizeof(__pyx_k_ctx_name), 0, 0, 1, 1},
{&__pyx_n_s_curr_idx, __pyx_k_curr_idx, sizeof(__pyx_k_curr_idx), 0, 0, 1, 1},
{&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
@@ -77234,8 +81910,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_d_sentences, __pyx_k_d_sentences, sizeof(__pyx_k_d_sentences), 0, 0, 1, 0},
{&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
{&__pyx_n_s_decode_lattice, __pyx_k_decode_lattice, sizeof(__pyx_k_decode_lattice), 0, 0, 1, 1},
+ {&__pyx_n_s_decode_lattice_locals_genexpr, __pyx_k_decode_lattice_locals_genexpr, sizeof(__pyx_k_decode_lattice_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_decode_sentence, __pyx_k_decode_sentence, sizeof(__pyx_k_decode_sentence), 0, 0, 1, 1},
+ {&__pyx_n_s_decode_sentence_locals_genexpr, __pyx_k_decode_sentence_locals_genexpr, sizeof(__pyx_k_decode_sentence_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_decode_words, __pyx_k_decode_words, sizeof(__pyx_k_decode_words), 0, 0, 1, 1},
+ {&__pyx_n_s_decode_words_locals_genexpr, __pyx_k_decode_words_locals_genexpr, sizeof(__pyx_k_decode_words_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
{&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1},
{&__pyx_n_s_doquicksort, __pyx_k_doquicksort, sizeof(__pyx_k_doquicksort), 0, 0, 1, 1},
@@ -77249,6 +81928,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_earray, __pyx_k_earray, sizeof(__pyx_k_earray), 0, 0, 1, 1},
{&__pyx_n_s_edarray, __pyx_k_edarray, sizeof(__pyx_k_edarray), 0, 0, 1, 1},
{&__pyx_n_s_encode_words, __pyx_k_encode_words, sizeof(__pyx_k_encode_words), 0, 0, 1, 1},
+ {&__pyx_n_s_encode_words_locals_genexpr, __pyx_k_encode_words_locals_genexpr, sizeof(__pyx_k_encode_words_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
{&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
{&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
@@ -77266,7 +81946,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_f_words, __pyx_k_f_words, sizeof(__pyx_k_f_words), 0, 0, 1, 1},
{&__pyx_n_s_fcount, __pyx_k_fcount, sizeof(__pyx_k_fcount), 0, 0, 1, 1},
{&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
+ {&__pyx_n_s_fmt_rule_locals_genexpr, __pyx_k_fmt_rule_locals_genexpr, sizeof(__pyx_k_fmt_rule_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_form_rule, __pyx_k_form_rule, sizeof(__pyx_k_form_rule), 0, 0, 1, 1},
+ {&__pyx_n_s_form_rule_locals_genexpr, __pyx_k_form_rule_locals_genexpr, sizeof(__pyx_k_form_rule_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_form_rule_locals_lambda, __pyx_k_form_rule_locals_lambda, sizeof(__pyx_k_form_rule_locals_lambda), 0, 0, 1, 1},
{&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
{&__pyx_n_s_fphrase, __pyx_k_fphrase, sizeof(__pyx_k_fphrase), 0, 0, 1, 1},
@@ -77307,6 +81989,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
{&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
{&__pyx_n_s_initial_len, __pyx_k_initial_len, sizeof(__pyx_k_initial_len), 0, 0, 1, 1},
+ {&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
+ {&__pyx_n_s_input_locals_genexpr, __pyx_k_input_locals_genexpr, sizeof(__pyx_k_input_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_input_locals_lambda, __pyx_k_input_locals_lambda, sizeof(__pyx_k_input_locals_lambda), 0, 0, 1, 1},
{&__pyx_n_s_input_locals_lambda_locals_lambd, __pyx_k_input_locals_lambda_locals_lambd, sizeof(__pyx_k_input_locals_lambda_locals_lambd), 0, 0, 1, 1},
{&__pyx_n_s_input_match, __pyx_k_input_match, sizeof(__pyx_k_input_match), 0, 0, 1, 1},
@@ -77314,7 +81998,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1},
{&__pyx_n_s_isa, __pyx_k_isa, sizeof(__pyx_k_isa), 0, 0, 1, 1},
{&__pyx_n_s_isvar, __pyx_k_isvar, sizeof(__pyx_k_isvar), 0, 0, 1, 1},
+ {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
{&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
+ {&__pyx_n_s_iterspans, __pyx_k_iterspans, sizeof(__pyx_k_iterspans), 0, 0, 1, 1},
+ {&__pyx_n_s_iterspans_locals_lambda, __pyx_k_iterspans_locals_lambda, sizeof(__pyx_k_iterspans_locals_lambda), 0, 0, 1, 1},
+ {&__pyx_n_s_iterspans_locals_lambda_locals_l, __pyx_k_iterspans_locals_lambda_locals_l, sizeof(__pyx_k_iterspans_locals_lambda_locals_l), 0, 0, 1, 1},
{&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
{&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 0, 1, 1},
{&__pyx_n_s_ito, __pyx_k_ito, sizeof(__pyx_k_ito), 0, 0, 1, 1},
@@ -77337,6 +82025,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_low, __pyx_k_low, sizeof(__pyx_k_low), 0, 0, 1, 1},
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
{&__pyx_n_s_make_lattice, __pyx_k_make_lattice, sizeof(__pyx_k_make_lattice), 0, 0, 1, 1},
+ {&__pyx_n_s_make_lattice_locals_genexpr, __pyx_k_make_lattice_locals_genexpr, sizeof(__pyx_k_make_lattice_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
{&__pyx_n_s_matches, __pyx_k_matches, sizeof(__pyx_k_matches), 0, 0, 1, 1},
{&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
@@ -77363,6 +82052,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_next_states, __pyx_k_next_states, sizeof(__pyx_k_next_states), 0, 0, 1, 1},
{&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1},
{&__pyx_n_s_nt_collision, __pyx_k_nt_collision, sizeof(__pyx_k_nt_collision), 0, 0, 1, 1},
+ {&__pyx_n_s_nt_flag, __pyx_k_nt_flag, sizeof(__pyx_k_nt_flag), 0, 0, 1, 1},
{&__pyx_n_s_nt_open, __pyx_k_nt_open, sizeof(__pyx_k_nt_open), 0, 0, 1, 1},
{&__pyx_n_s_ntc, __pyx_k_ntc, sizeof(__pyx_k_ntc), 0, 0, 1, 1},
{&__pyx_n_s_num_subpatterns, __pyx_k_num_subpatterns, sizeof(__pyx_k_num_subpatterns), 0, 0, 1, 1},
@@ -77397,6 +82087,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_reachable_buffer, __pyx_k_reachable_buffer, sizeof(__pyx_k_reachable_buffer), 0, 0, 1, 1},
{&__pyx_n_s_read_binary, __pyx_k_read_binary, sizeof(__pyx_k_read_binary), 0, 0, 1, 1},
{&__pyx_n_s_read_bitext, __pyx_k_read_bitext, sizeof(__pyx_k_read_bitext), 0, 0, 1, 1},
+ {&__pyx_n_s_read_bitext_locals_genexpr, __pyx_k_read_bitext_locals_genexpr, sizeof(__pyx_k_read_bitext_locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_read_text, __pyx_k_read_text, sizeof(__pyx_k_read_text), 0, 0, 1, 1},
{&__pyx_n_s_read_text_data, __pyx_k_read_text_data, sizeof(__pyx_k_read_text_data), 0, 0, 1, 1},
{&__pyx_n_s_require_aligned_chunks, __pyx_k_require_aligned_chunks, sizeof(__pyx_k_require_aligned_chunks), 0, 0, 1, 1},
@@ -77440,6 +82131,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
{&__pyx_n_s_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 0, 1, 1},
{&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
+ {&__pyx_n_s_str___locals_genexpr, __pyx_k_str___locals_genexpr, sizeof(__pyx_k_str___locals_genexpr), 0, 0, 1, 1},
{&__pyx_n_s_suffix_link, __pyx_k_suffix_link, sizeof(__pyx_k_suffix_link), 0, 0, 1, 1},
{&__pyx_n_s_sym, __pyx_k_sym, sizeof(__pyx_k_sym), 0, 0, 1, 1},
{&__pyx_n_s_syms, __pyx_k_syms, sizeof(__pyx_k_syms), 0, 0, 1, 1},
@@ -77448,6 +82140,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
{&__pyx_n_s_tight_phrases, __pyx_k_tight_phrases, sizeof(__pyx_k_tight_phrases), 0, 0, 1, 1},
{&__pyx_n_s_toMap, __pyx_k_toMap, sizeof(__pyx_k_toMap), 0, 0, 1, 1},
+ {&__pyx_n_s_to_str, __pyx_k_to_str, sizeof(__pyx_k_to_str), 0, 0, 1, 1},
{&__pyx_n_s_train_max_initial_size, __pyx_k_train_max_initial_size, sizeof(__pyx_k_train_max_initial_size), 0, 0, 1, 1},
{&__pyx_n_s_train_min_gap_size, __pyx_k_train_min_gap_size, sizeof(__pyx_k_train_min_gap_size), 0, 0, 1, 1},
{&__pyx_n_s_unlink, __pyx_k_unlink, sizeof(__pyx_k_unlink), 0, 0, 1, 1},
@@ -77456,9 +82149,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_use_collocations, __pyx_k_use_collocations, sizeof(__pyx_k_use_collocations), 0, 0, 1, 1},
{&__pyx_n_s_use_index, __pyx_k_use_index, sizeof(__pyx_k_use_index), 0, 0, 1, 1},
{&__pyx_n_s_use_sent_id, __pyx_k_use_sent_id, sizeof(__pyx_k_use_sent_id), 0, 0, 1, 1},
- {&__pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_k_usr0_home_mdenkows_cdec_python, sizeof(__pyx_k_usr0_home_mdenkows_cdec_python), 0, 0, 1, 0},
- {&__pyx_kp_s_usr0_home_mdenkows_cdec_python_2, __pyx_k_usr0_home_mdenkows_cdec_python_2, sizeof(__pyx_k_usr0_home_mdenkows_cdec_python_2), 0, 0, 1, 0},
- {&__pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_k_usr0_home_mdenkows_cdec_python_3, sizeof(__pyx_k_usr0_home_mdenkows_cdec_python_3), 0, 0, 1, 0},
{&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
{&__pyx_n_s_vec, __pyx_k_vec, sizeof(__pyx_k_vec), 0, 0, 1, 1},
{&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
@@ -77484,10 +82174,10 @@ static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_cmp = __Pyx_GetBuiltinName(__pyx_n_s_cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_cmp = __Pyx_GetBuiltinName(__pyx_n_s_cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
@@ -77499,7 +82189,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":20
+ /* "cdec/sa/data_array.pxi":20
* self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1}
* self.id2word = ["END_OF_FILE", "END_OF_LINE"]
* self.data = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -77510,7 +82200,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":21
+ /* "cdec/sa/data_array.pxi":21
* self.id2word = ["END_OF_FILE", "END_OF_LINE"]
* self.data = IntList(1000,1000)
* self.sent_id = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -77521,7 +82211,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__4);
__Pyx_GIVEREF(__pyx_tuple__4);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22
+ /* "cdec/sa/data_array.pxi":22
* self.data = IntList(1000,1000)
* self.sent_id = IntList(1000,1000)
* self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -77532,7 +82222,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__5);
__Pyx_GIVEREF(__pyx_tuple__5);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":66
+ /* "cdec/sa/data_array.pxi":66
* f.write("%s " % self.get_word(w_id))
* if w_id == 1:
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77543,7 +82233,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__7);
__Pyx_GIVEREF(__pyx_tuple__7);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61
+ /* "cdec/sa/data_array.pxi":61
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -77554,7 +82244,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__8);
__Pyx_GIVEREF(__pyx_tuple__8);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69
+ /* "cdec/sa/data_array.pxi":69
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -77565,7 +82255,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__9);
__Pyx_GIVEREF(__pyx_tuple__9);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":74
+ /* "cdec/sa/data_array.pxi":74
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp:
* data = (line.split(' ||| ')[side] for line in fp) # <<<<<<<<<<<<<<
@@ -77576,7 +82266,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__11);
__Pyx_GIVEREF(__pyx_tuple__11);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73
+ /* "cdec/sa/data_array.pxi":73
*
* def read_bitext(self, char* filename, int side):
* with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<<
@@ -77587,7 +82277,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__12);
__Pyx_GIVEREF(__pyx_tuple__12);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":130
+ /* "cdec/sa/data_array.pxi":130
* num_words = len(self.id2word) - 2
* fwrite(&(num_words), sizeof(int), 1, f)
* for word in self.id2word[2:]: # <<<<<<<<<<<<<<
@@ -77598,7 +82288,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_slice__13);
__Pyx_GIVEREF(__pyx_slice__13);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144
+ /* "cdec/sa/data_array.pxi":144
* for i in self.data:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77609,7 +82299,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__14);
__Pyx_GIVEREF(__pyx_tuple__14);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":147
+ /* "cdec/sa/data_array.pxi":147
* for i in self.sent_index:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77620,7 +82310,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__15);
__Pyx_GIVEREF(__pyx_tuple__15);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":150
+ /* "cdec/sa/data_array.pxi":150
* for i in self.sent_id:
* f.write("%d " %i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77631,7 +82321,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__16);
__Pyx_GIVEREF(__pyx_tuple__16);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153
+ /* "cdec/sa/data_array.pxi":153
* for word in self.id2word:
* f.write("%s %d " % (word, self.word2id[word]))
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77642,7 +82332,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__17);
__Pyx_GIVEREF(__pyx_tuple__17);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156
+ /* "cdec/sa/data_array.pxi":156
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -77652,7 +82342,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__18);
__Pyx_GIVEREF(__pyx_tuple__18);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48
+ /* "cdec/sa/alignment.pxi":48
*
* def __cinit__(self, from_binary=None, from_text=None):
* self.links = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -77663,7 +82353,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__19);
__Pyx_GIVEREF(__pyx_tuple__19);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":49
+ /* "cdec/sa/alignment.pxi":49
* def __cinit__(self, from_binary=None, from_text=None):
* self.links = IntList(1000,1000)
* self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<<
@@ -77674,7 +82364,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__20);
__Pyx_GIVEREF(__pyx_tuple__20);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61
+ /* "cdec/sa/alignment.pxi":61
* pairs = line.split()
* for pair in pairs:
* (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<<
@@ -77685,7 +82375,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__22);
__Pyx_GIVEREF(__pyx_tuple__22);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56
+ /* "cdec/sa/alignment.pxi":56
*
* def read_text(self, char* filename):
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
@@ -77696,7 +82386,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__23);
__Pyx_GIVEREF(__pyx_tuple__23);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":77
+ /* "cdec/sa/alignment.pxi":77
* for i, link in enumerate(self.links):
* while i >= self.sent_index[sent_num]:
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77707,7 +82397,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__24);
__Pyx_GIVEREF(__pyx_tuple__24);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80
+ /* "cdec/sa/alignment.pxi":80
* sent_num = sent_num + 1
* f.write("%d-%d " % self.unlink(link))
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77718,7 +82408,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__25);
__Pyx_GIVEREF(__pyx_tuple__25);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73
+ /* "cdec/sa/alignment.pxi":73
*
* def write_text(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -77729,7 +82419,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__26);
__Pyx_GIVEREF(__pyx_tuple__26);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93
+ /* "cdec/sa/alignment.pxi":93
* for link in self.links:
* f.write("%d " % link)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77740,7 +82430,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__27);
__Pyx_GIVEREF(__pyx_tuple__27);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":96
+ /* "cdec/sa/alignment.pxi":96
* for i in self.sent_index:
* f.write("%d " % i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -77751,7 +82441,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__28);
__Pyx_GIVEREF(__pyx_tuple__28);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90
+ /* "cdec/sa/alignment.pxi":90
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -77762,106 +82452,106 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__29);
__Pyx_GIVEREF(__pyx_tuple__29);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305
+ /* "cdec/sa/bilex.pxi":312
*
* # Re-read file, placing words into buckets
* f.seek(0) # <<<<<<<<<<<<<<
* for line in f:
* (fword, eword, score1, score2) = line.split()
*/
- __pyx_tuple__30 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__30);
__Pyx_GIVEREF(__pyx_tuple__30);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281
+ /* "cdec/sa/bilex.pxi":288
*
* fcount = IntList()
* with gzip_or_text(filename) as f: # <<<<<<<<<<<<<<
* # first loop merely establishes size of array objects
* for line in f:
*/
- __pyx_tuple__31 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__31 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__31);
__Pyx_GIVEREF(__pyx_tuple__31);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347
+ /* "cdec/sa/bilex.pxi":354
*
* if i > j:
* raise Exception("Sort error in CLex") # <<<<<<<<<<<<<<
* if i == j: #empty interval
* return
*/
- __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_Sort_error_in_CLex); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_Sort_error_in_CLex); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__33);
__Pyx_GIVEREF(__pyx_tuple__33);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370
+ /* "cdec/sa/bilex.pxi":377
* for i in self.f_index:
* f.write("%d " % i)
* f.write("\n") # <<<<<<<<<<<<<<
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
* f.write("%d %f %f " % (i, s1, s2))
*/
- __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__35);
__Pyx_GIVEREF(__pyx_tuple__35);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":373
+ /* "cdec/sa/bilex.pxi":380
* for i, s1, s2 in zip(self.e_index, self.col1, self.col2):
* f.write("%d %f %f " % (i, s1, s2))
* f.write("\n") # <<<<<<<<<<<<<<
* for i, w in enumerate(self.id2fword):
* f.write("%d %s " % (i, w))
*/
- __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__36);
__Pyx_GIVEREF(__pyx_tuple__36);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":376
+ /* "cdec/sa/bilex.pxi":383
* for i, w in enumerate(self.id2fword):
* f.write("%d %s " % (i, w))
* f.write("\n") # <<<<<<<<<<<<<<
* for i, w in enumerate(self.id2eword):
* f.write("%d %s " % (i, w))
*/
- __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__37);
__Pyx_GIVEREF(__pyx_tuple__37);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379
+ /* "cdec/sa/bilex.pxi":386
* for i, w in enumerate(self.id2eword):
* f.write("%d %s " % (i, w))
* f.write("\n") # <<<<<<<<<<<<<<
*
*
*/
- __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s__6); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__38);
__Pyx_GIVEREF(__pyx_tuple__38);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367
+ /* "cdec/sa/bilex.pxi":374
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
* for i in self.f_index:
* f.write("%d " % i)
*/
- __pyx_tuple__39 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__39 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__39);
__Pyx_GIVEREF(__pyx_tuple__39);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412
+ /* "cdec/sa/bilex.pxi":419
* cdef i, N, e_id, f_id
*
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
* N = len(self.e_index)
* f_id = 0
*/
- __pyx_tuple__40 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__40 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__40);
__Pyx_GIVEREF(__pyx_tuple__40);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13
+ /* "cdec/sa/lcp.pxi":13
* cdef IntList rank
*
* logger.info("Constructing LCP array") # <<<<<<<<<<<<<<
@@ -77872,7 +82562,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__43);
__Pyx_GIVEREF(__pyx_tuple__43);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34
+ /* "cdec/sa/lcp.pxi":34
* if h > 0:
* h = h-1
* logger.info("LCP array completed") # <<<<<<<<<<<<<<
@@ -77883,7 +82573,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__44);
__Pyx_GIVEREF(__pyx_tuple__44);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297
+ /* "cdec/sa/precomputation.pxi":297
* pattern_rank = {}
*
* logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<<
@@ -77894,7 +82584,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__47);
__Pyx_GIVEREF(__pyx_tuple__47);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314
+ /* "cdec/sa/precomputation.pxi":314
* queue = IntList(increment=1000)
*
* logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<<
@@ -77905,7 +82595,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__48);
__Pyx_GIVEREF(__pyx_tuple__48);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329
+ /* "cdec/sa/precomputation.pxi":329
* trie_node_data_append(node, i)
*
* logger.info(" Computing collocations...") # <<<<<<<<<<<<<<
@@ -77916,7 +82606,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__49);
__Pyx_GIVEREF(__pyx_tuple__49);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":386
+ /* "cdec/sa/precomputation.pxi":386
* ptr1 = ptr1 + 1
*
* self.precomputed_collocations = collocations.toMap(False) # <<<<<<<<<<<<<<
@@ -77927,7 +82617,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__50);
__Pyx_GIVEREF(__pyx_tuple__50);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":387
+ /* "cdec/sa/precomputation.pxi":387
*
* self.precomputed_collocations = collocations.toMap(False)
* self.precomputed_index = frequent_patterns.toMap(True) # <<<<<<<<<<<<<<
@@ -77938,7 +82628,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__51);
__Pyx_GIVEREF(__pyx_tuple__51);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":393
+ /* "cdec/sa/precomputation.pxi":393
* for pattern2 in J_set:
* if len(pattern1) + len(pattern2) + 1 < self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
@@ -77949,7 +82639,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__52);
__Pyx_GIVEREF(__pyx_tuple__52);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":400
+ /* "cdec/sa/precomputation.pxi":400
* x = x+1
* if len(pattern1) + len(pattern2) + 1 <= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
@@ -77960,7 +82650,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__53);
__Pyx_GIVEREF(__pyx_tuple__53);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":407
+ /* "cdec/sa/precomputation.pxi":407
* x = x+2
* if len(pattern1) + len(pattern2) + 1<= self.max_length:
* combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<<
@@ -77971,7 +82661,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__54);
__Pyx_GIVEREF(__pyx_tuple__54);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":409
+ /* "cdec/sa/precomputation.pxi":409
* combined_pattern = pattern1 + (-1,) + pattern2
* IJ_set.add(combined_pattern)
* combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<<
@@ -77982,7 +82672,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__55);
__Pyx_GIVEREF(__pyx_tuple__55);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":94
+ /* "cdec/sa/suffix_array.pxi":94
*
* '''Step 3: read off suffix array from inverse suffix array'''
* logger.info(" Finalizing sort...") # <<<<<<<<<<<<<<
@@ -77993,7 +82683,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__56);
__Pyx_GIVEREF(__pyx_tuple__56);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":193
+ /* "cdec/sa/suffix_array.pxi":193
* for a_i in self.sa:
* f.write("%d " % a_i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -78004,7 +82694,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__57);
__Pyx_GIVEREF(__pyx_tuple__57);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":196
+ /* "cdec/sa/suffix_array.pxi":196
* for w_i in self.ha:
* f.write("%d " % w_i)
* f.write("\n") # <<<<<<<<<<<<<<
@@ -78015,7 +82705,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__58);
__Pyx_GIVEREF(__pyx_tuple__58);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189
+ /* "cdec/sa/suffix_array.pxi":189
*
* def write_enhanced(self, char* filename):
* with open(filename, "w") as f: # <<<<<<<<<<<<<<
@@ -78026,7 +82716,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__59);
__Pyx_GIVEREF(__pyx_tuple__59);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":140
+ /* "cdec/sa/rulefactory.pxi":140
* logger.info("Sampling strategy: uniform, max sample size = %d", sample_size)
* else:
* logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<<
@@ -78037,7 +82727,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__60);
__Pyx_GIVEREF(__pyx_tuple__60);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":353
+ /* "cdec/sa/rulefactory.pxi":353
* respectively. This is because Chiang's model does not require
* them to be the same, therefore we don't either.'''
* self.rules = TrieTable(True) # cache # <<<<<<<<<<<<<<
@@ -78048,7 +82738,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__61);
__Pyx_GIVEREF(__pyx_tuple__61);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":356
+ /* "cdec/sa/rulefactory.pxi":356
* self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation())
* if alignment is None:
* raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<<
@@ -78059,7 +82749,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__62);
__Pyx_GIVEREF(__pyx_tuple__62);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1072
+ /* "cdec/sa/rulefactory.pxi":1072
* else:
* #ERROR: We never get here
* raise Exception("Keyword trie error") # <<<<<<<<<<<<<<
@@ -78070,73 +82760,73 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__66);
__Pyx_GIVEREF(__pyx_tuple__66);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1991
+ /* "cdec/sa/rulefactory.pxi":2003
* if nt and nt[-1][2] == f_j - 1:
* # Add to non-terminal, checking for collisions
* old_last_nt = nt[-1][:] # <<<<<<<<<<<<<<
* nt[-1][2] = f_j
* if link_i < nt[-1][3]:
*/
- __pyx_slice__67 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__67)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_slice__67 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__67)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_slice__67);
__Pyx_GIVEREF(__pyx_slice__67);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928
+ /* "cdec/sa/rulefactory.pxi":1940
* # f_ i and j are current, e_ i and j are previous
* # We care _considering_ f_j, so it is not yet in counts
* def extract(f_i, f_j, e_i, e_j, min_bound, wc, links, nt, nt_open): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_tuple__68 = PyTuple_Pack(19, __pyx_n_s_f_i, __pyx_n_s_f_j, __pyx_n_s_e_i, __pyx_n_s_e_j, __pyx_n_s_min_bound, __pyx_n_s_wc, __pyx_n_s_links, __pyx_n_s_nt, __pyx_n_s_nt_open, __pyx_n_s_link_i, __pyx_n_s_link_j, __pyx_n_s_new_e_i, __pyx_n_s_new_e_j, __pyx_n_s_new_min_bound, __pyx_n_s_i, __pyx_n_s_nt_collision, __pyx_n_s_link, __pyx_n_s_plus_links, __pyx_n_s_old_last_nt); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__68 = PyTuple_Pack(19, __pyx_n_s_f_i, __pyx_n_s_f_j, __pyx_n_s_e_i, __pyx_n_s_e_j, __pyx_n_s_min_bound, __pyx_n_s_wc, __pyx_n_s_links, __pyx_n_s_nt, __pyx_n_s_nt_open, __pyx_n_s_link_i, __pyx_n_s_link_j, __pyx_n_s_new_e_i, __pyx_n_s_new_e_j, __pyx_n_s_new_min_bound, __pyx_n_s_i, __pyx_n_s_nt_collision, __pyx_n_s_link, __pyx_n_s_plus_links, __pyx_n_s_old_last_nt); if (unlikely(!__pyx_tuple__68)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__68);
__Pyx_GIVEREF(__pyx_tuple__68);
- __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_n_s_extract, 1928, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_extract, 1940, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2050
+ /* "cdec/sa/rulefactory.pxi":2062
* # Update phrase counts
* for rule in rules:
* (f_ph, e_ph, al) = rule[:3] # <<<<<<<<<<<<<<
* stats.phrases_f[f_ph] += 1
* stats.phrases_e[e_ph] += 1
*/
- __pyx_slice__70 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__70)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_slice__70 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__70)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_slice__70);
__Pyx_GIVEREF(__pyx_slice__70);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2065
+ /* "cdec/sa/rulefactory.pxi":2077
* # Substitute in non-terminals
* nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3]))
* f_sym = list(f_span[:]) # <<<<<<<<<<<<<<
* off = f_i
* for next_nt in nt:
*/
- __pyx_slice__71 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__71)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_slice__71 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__71)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_slice__71);
__Pyx_GIVEREF(__pyx_slice__71);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075
+ /* "cdec/sa/rulefactory.pxi":2087
* f_sym.insert(next_nt[1] - off, sym_setindex(self.category, next_nt[0]))
* off += (nt_len - 1)
* e_sym = list(e_span[:]) # <<<<<<<<<<<<<<
* off = e_i
* for next_nt in nt_inv:
*/
- __pyx_slice__72 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__72)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_slice__72 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__72)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_slice__72);
__Pyx_GIVEREF(__pyx_slice__72);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150
+ /* "cdec/sa/rulefactory.pxi":2162
* phrases = set() # (fphrase, lex_i, lex_j)
*
* def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<<
* # Phrase extraction limits
* if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size:
*/
- __pyx_tuple__73 = PyTuple_Pack(10, __pyx_n_s_f_i, __pyx_n_s_f_j, __pyx_n_s_lex_i, __pyx_n_s_lex_j, __pyx_n_s_wc, __pyx_n_s_ntc, __pyx_n_s_syms, __pyx_n_s_f, __pyx_n_s_new_lex_i, __pyx_n_s_new_lex_j); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__73 = PyTuple_Pack(10, __pyx_n_s_f_i, __pyx_n_s_f_j, __pyx_n_s_lex_i, __pyx_n_s_lex_j, __pyx_n_s_wc, __pyx_n_s_ntc, __pyx_n_s_syms, __pyx_n_s_f, __pyx_n_s_new_lex_i, __pyx_n_s_new_lex_j); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__73);
__Pyx_GIVEREF(__pyx_tuple__73);
- __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_n_s_extract, 2150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_extract, 2162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/sa/_sa.pyx":5
* import gzip
@@ -78145,7 +82835,7 @@ static int __Pyx_InitCachedConstants(void) {
* return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+
* resource.getrusage(resource.RUSAGE_SELF).ru_stime)
*/
- __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_2, __pyx_n_s_monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_2, __pyx_n_s_monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/sa/_sa.pyx":9
* resource.getrusage(resource.RUSAGE_SELF).ru_stime)
@@ -78157,7 +82847,7 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_filename, __pyx_n_s_filename); if (unlikely(!__pyx_tuple__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__76);
__Pyx_GIVEREF(__pyx_tuple__76);
- __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_2, __pyx_n_s_gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_2, __pyx_n_s_gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cdec/sa/_sa.pyx":15
* return open(filename)
@@ -78170,7 +82860,7 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_GOTREF(__pyx_tuple__78);
__Pyx_GIVEREF(__pyx_tuple__78);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107
+ /* "cdec/sa/sym.pxi":107
* return ALPHABET.fromstring(string, terminal)
*
* def isvar(sym): # <<<<<<<<<<<<<<
@@ -78180,9 +82870,9 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__79 = PyTuple_Pack(1, __pyx_n_s_sym); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__79);
__Pyx_GIVEREF(__pyx_tuple__79);
- __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+ /* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -78192,9 +82882,9 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__81 = PyTuple_Pack(5, __pyx_n_s_words, __pyx_n_s_word_ids, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__81);
__Pyx_GIVEREF(__pyx_tuple__81);
- __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+ /* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -78204,9 +82894,9 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_lattice, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__83);
__Pyx_GIVEREF(__pyx_tuple__83);
- __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+ /* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -78216,9 +82906,9 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__85 = PyTuple_Pack(3, __pyx_n_s_lattice, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__85)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__85);
__Pyx_GIVEREF(__pyx_tuple__85);
- __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+ /* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -78228,9 +82918,9 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__87 = PyTuple_Pack(3, __pyx_n_s_words, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__87);
__Pyx_GIVEREF(__pyx_tuple__87);
- __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+ /* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -78239,43 +82929,43 @@ static int __Pyx_InitCachedConstants(void) {
__pyx_tuple__89 = PyTuple_Pack(3, __pyx_n_s_syms, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__89);
__Pyx_GIVEREF(__pyx_tuple__89);
- __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python_3, __pyx_n_s_decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my_3, __pyx_n_s_decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188
+ /* "cdec/sa/rulefactory.pxi":2200
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_tuple__91 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__91 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__91);
__Pyx_GIVEREF(__pyx_tuple__91);
- __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_n_s_span_check, 2188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_span_check, 2200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
+ /* "cdec/sa/rulefactory.pxi":2208
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_tuple__93 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__93 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__93);
__Pyx_GIVEREF(__pyx_tuple__93);
- __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_n_s_span_inc, 2196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_span_inc, 2208, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
+ /* "cdec/sa/rulefactory.pxi":2214
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_tuple__95 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__95 = PyTuple_Pack(4, __pyx_n_s_vec, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__95);
__Pyx_GIVEREF(__pyx_tuple__95);
- __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr0_home_mdenkows_cdec_python, __pyx_n_s_span_dec, 2202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_waziz_workspace_mtm14_my, __pyx_n_s_span_dec, 2214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -78311,6 +83001,9 @@ PyMODINIT_FUNC PyInit__sa(void)
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ Py_ssize_t __pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -78346,25 +83039,25 @@ PyMODINIT_FUNC PyInit__sa(void)
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
- __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_sa"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
+ __pyx_m = Py_InitModule4("_sa", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
Py_INCREF(__pyx_d);
- __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
- if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
if (__pyx_module_is_main_cdec__sa___sa) {
- if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
#if PY_MAJOR_VERSION >= 3
{
@@ -78395,7 +83088,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_FloatList.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_FloatList.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "FloatList", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "FloatList", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_FloatList = &__pyx_type_4cdec_2sa_3_sa_FloatList;
__pyx_vtabptr_4cdec_2sa_3_sa_IntList = &__pyx_vtable_4cdec_2sa_3_sa_IntList;
__pyx_vtable_4cdec_2sa_3_sa_IntList.set = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int, int))__pyx_f_4cdec_2sa_3_sa_7IntList_set;
@@ -78408,11 +83101,11 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_IntList.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_IntList.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "IntList", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "IntList", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_IntList = &__pyx_type_4cdec_2sa_3_sa_IntList;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_FeatureVector) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_FeatureVector.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "FeatureVector", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_FeatureVector) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "FeatureVector", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_FeatureVector) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_FeatureVector = &__pyx_type_4cdec_2sa_3_sa_FeatureVector;
__pyx_vtabptr_4cdec_2sa_3_sa_Phrase = &__pyx_vtable_4cdec_2sa_3_sa_Phrase;
__pyx_vtable_4cdec_2sa_3_sa_Phrase.chunkpos = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int))__pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos;
@@ -78420,11 +83113,11 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Phrase.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_Phrase.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Phrase", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Phrase", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Phrase = &__pyx_type_4cdec_2sa_3_sa_Phrase;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Rule.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "Rule", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Rule", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Rule = &__pyx_type_4cdec_2sa_3_sa_Rule;
__pyx_vtabptr_4cdec_2sa_3_sa_StringMap = &__pyx_vtable_4cdec_2sa_3_sa_StringMap;
__pyx_vtable_4cdec_2sa_3_sa_StringMap.word = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *, int))__pyx_f_4cdec_2sa_3_sa_9StringMap_word;
@@ -78432,7 +83125,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_StringMap.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_StringMap.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "StringMap", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "StringMap", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_StringMap = &__pyx_type_4cdec_2sa_3_sa_StringMap;
__pyx_vtabptr_4cdec_2sa_3_sa_DataArray = &__pyx_vtable_4cdec_2sa_3_sa_DataArray;
__pyx_vtable_4cdec_2sa_3_sa_DataArray.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *, FILE *))__pyx_f_4cdec_2sa_3_sa_9DataArray_read_handle;
@@ -78440,7 +83133,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_DataArray.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_DataArray.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "DataArray", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "DataArray", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_DataArray = &__pyx_type_4cdec_2sa_3_sa_DataArray;
__pyx_vtabptr_4cdec_2sa_3_sa_Alignment = &__pyx_vtable_4cdec_2sa_3_sa_Alignment;
__pyx_vtable_4cdec_2sa_3_sa_Alignment.link = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int))__pyx_f_4cdec_2sa_3_sa_9Alignment_link;
@@ -78449,7 +83142,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Alignment.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_Alignment.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Alignment", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Alignment", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Alignment = &__pyx_type_4cdec_2sa_3_sa_Alignment;
__pyx_vtabptr_4cdec_2sa_3_sa_BiLex = &__pyx_vtable_4cdec_2sa_3_sa_BiLex;
__pyx_vtable_4cdec_2sa_3_sa_BiLex.compute_from_data = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *))__pyx_f_4cdec_2sa_3_sa_5BiLex_compute_from_data;
@@ -78461,19 +83154,19 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_BiLex.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_BiLex.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "BiLex", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "BiLex", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_BiLex = &__pyx_type_4cdec_2sa_3_sa_BiLex;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_BitSetIterator.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "BitSetIterator", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "BitSetIterator", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = &__pyx_type_4cdec_2sa_3_sa_BitSetIterator;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_BitSet.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "BitSet", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "BitSet", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_BitSet = &__pyx_type_4cdec_2sa_3_sa_BitSet;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_VEBIterator.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "VEBIterator", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "VEBIterator", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_VEBIterator = &__pyx_type_4cdec_2sa_3_sa_VEBIterator;
__pyx_vtabptr_4cdec_2sa_3_sa_VEB = &__pyx_vtable_4cdec_2sa_3_sa_VEB;
__pyx_vtable_4cdec_2sa_3_sa_VEB._findsucc = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *, int))__pyx_f_4cdec_2sa_3_sa_3VEB__findsucc;
@@ -78482,11 +83175,11 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_VEB.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_VEB.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "VEB", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "VEB", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_VEB = &__pyx_type_4cdec_2sa_3_sa_VEB;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_LCP.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "LCP", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "LCP", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_LCP = &__pyx_type_4cdec_2sa_3_sa_LCP;
__pyx_vtabptr_4cdec_2sa_3_sa_Alphabet = &__pyx_vtable_4cdec_2sa_3_sa_Alphabet;
__pyx_vtable_4cdec_2sa_3_sa_Alphabet.isvar = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_isvar;
@@ -78502,7 +83195,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Alphabet.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_Alphabet.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Alphabet", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Alphabet", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Alphabet = &__pyx_type_4cdec_2sa_3_sa_Alphabet;
__pyx_vtabptr_4cdec_2sa_3_sa_TrieMap = &__pyx_vtable_4cdec_2sa_3_sa_TrieMap;
__pyx_vtable_4cdec_2sa_3_sa_TrieMap._insert = (struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *(*)(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *, int *, int))__pyx_f_4cdec_2sa_3_sa_7TrieMap__insert;
@@ -78510,7 +83203,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_TrieMap.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_TrieMap.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "TrieMap", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "TrieMap", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_TrieMap = &__pyx_type_4cdec_2sa_3_sa_TrieMap;
__pyx_vtabptr_4cdec_2sa_3_sa_Precomputation = &__pyx_vtable_4cdec_2sa_3_sa_Precomputation;
__pyx_vtable_4cdec_2sa_3_sa_Precomputation.read_map = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *, FILE *))__pyx_f_4cdec_2sa_3_sa_14Precomputation_read_map;
@@ -78518,7 +83211,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Precomputation.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_Precomputation.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Precomputation", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Precomputation", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Precomputation = &__pyx_type_4cdec_2sa_3_sa_Precomputation;
__pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray = &__pyx_vtable_4cdec_2sa_3_sa_SuffixArray;
__pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___search_high = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_high;
@@ -78528,35 +83221,35 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_SuffixArray.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_SuffixArray.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "SuffixArray", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "SuffixArray", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_SuffixArray = &__pyx_type_4cdec_2sa_3_sa_SuffixArray;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_OnlineStats.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "OnlineStats", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "OnlineStats", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_OnlineStats = &__pyx_type_4cdec_2sa_3_sa_OnlineStats;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_TrieNode.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_TrieNode = &__pyx_type_4cdec_2sa_3_sa_TrieNode;
__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode.tp_base = __pyx_ptype_4cdec_2sa_3_sa_TrieNode;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = &__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_TrieTable.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_TrieTable = &__pyx_type_4cdec_2sa_3_sa_TrieTable;
__pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation = &__pyx_vtable_4cdec_2sa_3_sa_PhraseLocation;
__pyx_vtable_4cdec_2sa_3_sa_PhraseLocation.contains = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, int))__pyx_f_4cdec_2sa_3_sa_14PhraseLocation_contains;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_PhraseLocation.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_PhraseLocation.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "PhraseLocation", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "PhraseLocation", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = &__pyx_type_4cdec_2sa_3_sa_PhraseLocation;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Sampler.tp_print = 0;
- if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Sampler = &__pyx_type_4cdec_2sa_3_sa_Sampler;
__pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory = &__pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory;
__pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.set_idmap = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_set_idmap;
@@ -78577,14 +83270,14 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "HieroCachingRuleFactory", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "HieroCachingRuleFactory", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = &__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory;
__pyx_vtabptr_4cdec_2sa_3_sa_Scorer = &__pyx_vtable_4cdec_2sa_3_sa_Scorer;
__pyx_vtable_4cdec_2sa_3_sa_Scorer.score = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *, PyObject *))__pyx_f_4cdec_2sa_3_sa_6Scorer_score;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa_Scorer.tp_print = 0;
if (__Pyx_SetVtable(__pyx_type_4cdec_2sa_3_sa_Scorer.tp_dict, __pyx_vtabptr_4cdec_2sa_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyObject_SetAttrString(__pyx_m, "Scorer", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_4cdec_2sa_3_sa_Scorer = &__pyx_type_4cdec_2sa_3_sa_Scorer;
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__.tp_print = 0;
@@ -78634,48 +83327,51 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__.tp_print = 0;
__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_input = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__;
- if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr.tp_print = 0;
- __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16_iterspans;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17___str__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17___str__.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17___str__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17___str__;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_alignments;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_input.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_input = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_input;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_add_instance;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_form_rule;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_fmt_rule;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_genexpr;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27_get_f_phrases;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___iter__;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29___str__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29___str__.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_29___str__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29___str__;
+ if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr.tp_print = 0;
+ __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_30_genexpr;
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
@@ -78756,7 +83452,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":8
+ /* "cdec/sa/alignment.pxi":8
* # May need to revisit if things get really tight, though.
*
* cdef int ALIGNMENT_CODE = 1 << 16 # <<<<<<<<<<<<<<
@@ -78765,7 +83461,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE = 65536;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":17
+ /* "cdec/sa/veb.pxi":17
* from libc.string cimport memset
*
* cdef int MIN_BOTTOM_SIZE = 32 # <<<<<<<<<<<<<<
@@ -78774,7 +83470,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE = 32;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":18
+ /* "cdec/sa/veb.pxi":18
*
* cdef int MIN_BOTTOM_SIZE = 32
* cdef int MIN_BOTTOM_BITS = 5 # <<<<<<<<<<<<<<
@@ -78783,7 +83479,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS = 5;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/veb.pxi":28
+ /* "cdec/sa/veb.pxi":28
* LOWER_MASK[i] = mask
*
* _init_lower_mask() # <<<<<<<<<<<<<<
@@ -78792,7 +83488,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_f_4cdec_2sa_3_sa__init_lower_mask();
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":4
+ /* "cdec/sa/sym.pxi":4
* from libc.stdlib cimport malloc, realloc, strtol
*
* cdef int INDEX_SHIFT = 3 # <<<<<<<<<<<<<<
@@ -78801,7 +83497,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT = 3;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":5
+ /* "cdec/sa/sym.pxi":5
*
* cdef int INDEX_SHIFT = 3
* cdef int INDEX_MASK = (1<<INDEX_SHIFT)-1 # <<<<<<<<<<<<<<
@@ -78810,7 +83506,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_INDEX_MASK = ((1 << __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT) - 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":87
+ /* "cdec/sa/sym.pxi":87
* return self.terminals.index(s)
*
* cdef Alphabet ALPHABET = Alphabet() # <<<<<<<<<<<<<<
@@ -78824,7 +83520,7 @@ PyMODINIT_FUNC PyInit__sa(void)
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107
+ /* "cdec/sa/sym.pxi":107
* return ALPHABET.fromstring(string, terminal)
*
* def isvar(sym): # <<<<<<<<<<<<<<
@@ -78836,7 +83532,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_isvar, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110
+ /* "cdec/sa/sym.pxi":110
* return sym_isvar(sym)
*
* def make_lattice(words): # <<<<<<<<<<<<<<
@@ -78848,7 +83544,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_lattice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114
+ /* "cdec/sa/sym.pxi":114
* return tuple(((word, None, 1), ) for word in word_ids)
*
* def decode_lattice(lattice): # <<<<<<<<<<<<<<
@@ -78860,7 +83556,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_lattice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118
+ /* "cdec/sa/sym.pxi":118
* for arc in node for node in lattice)
*
* def decode_sentence(lattice): # <<<<<<<<<<<<<<
@@ -78872,7 +83568,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_sentence, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121
+ /* "cdec/sa/sym.pxi":121
* return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice)
*
* def encode_words(words): # <<<<<<<<<<<<<<
@@ -78884,7 +83580,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_words, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124
+ /* "cdec/sa/sym.pxi":124
* return tuple(sym_fromstring(word, True) for word in words)
*
* def decode_words(syms): # <<<<<<<<<<<<<<
@@ -78895,7 +83591,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_words, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":5
+ /* "cdec/sa/rulefactory.pxi":5
* # Much faster than the Python numbers reported there.
* # Note to reader: this code is closer to C than Python
* import gc # <<<<<<<<<<<<<<
@@ -78907,7 +83603,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":6
+ /* "cdec/sa/rulefactory.pxi":6
* # Note to reader: this code is closer to C than Python
* import gc
* import itertools # <<<<<<<<<<<<<<
@@ -78919,7 +83615,7 @@ PyMODINIT_FUNC PyInit__sa(void)
if (PyDict_SetItem(__pyx_d, __pyx_n_s_itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":12
+ /* "cdec/sa/rulefactory.pxi":12
* from libc.math cimport fmod, ceil, floor, log
*
* from collections import defaultdict, Counter, namedtuple # <<<<<<<<<<<<<<
@@ -78954,7 +83650,7 @@ PyMODINIT_FUNC PyInit__sa(void)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":14
+ /* "cdec/sa/rulefactory.pxi":14
* from collections import defaultdict, Counter, namedtuple
*
* from online import Bilex # <<<<<<<<<<<<<<
@@ -78975,88 +83671,95 @@ PyMODINIT_FUNC PyInit__sa(void)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":16
+ /* "cdec/sa/rulefactory.pxi":16
* from online import Bilex
*
* FeatureContext = namedtuple('FeatureContext', # <<<<<<<<<<<<<<
* ['fphrase',
* 'ephrase',
*/
- __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":17
+ /* "cdec/sa/rulefactory.pxi":17
*
* FeatureContext = namedtuple('FeatureContext',
* ['fphrase', # <<<<<<<<<<<<<<
* 'ephrase',
* 'paircount',
*/
- __pyx_t_2 = PyList_New(13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyList_New(13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_n_s_fphrase);
- PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_fphrase);
+ PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_fphrase);
__Pyx_GIVEREF(__pyx_n_s_fphrase);
__Pyx_INCREF(__pyx_n_s_ephrase);
- PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ephrase);
+ PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_ephrase);
__Pyx_GIVEREF(__pyx_n_s_ephrase);
__Pyx_INCREF(__pyx_n_s_paircount);
- PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_paircount);
+ PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_paircount);
__Pyx_GIVEREF(__pyx_n_s_paircount);
__Pyx_INCREF(__pyx_n_s_fcount);
- PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_fcount);
+ PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_fcount);
__Pyx_GIVEREF(__pyx_n_s_fcount);
__Pyx_INCREF(__pyx_n_s_fsample_count);
- PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_fsample_count);
+ PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_fsample_count);
__Pyx_GIVEREF(__pyx_n_s_fsample_count);
__Pyx_INCREF(__pyx_n_s_input_span);
- PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_input_span);
+ PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_input_span);
__Pyx_GIVEREF(__pyx_n_s_input_span);
__Pyx_INCREF(__pyx_n_s_matches);
- PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_matches);
+ PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_matches);
__Pyx_GIVEREF(__pyx_n_s_matches);
__Pyx_INCREF(__pyx_n_s_input_match);
- PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_input_match);
+ PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_input_match);
__Pyx_GIVEREF(__pyx_n_s_input_match);
__Pyx_INCREF(__pyx_n_s_test_sentence);
- PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_test_sentence);
+ PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_test_sentence);
__Pyx_GIVEREF(__pyx_n_s_test_sentence);
__Pyx_INCREF(__pyx_n_s_f_text);
- PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_f_text);
+ PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_f_text);
__Pyx_GIVEREF(__pyx_n_s_f_text);
__Pyx_INCREF(__pyx_n_s_e_text);
- PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_s_e_text);
+ PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_e_text);
__Pyx_GIVEREF(__pyx_n_s_e_text);
__Pyx_INCREF(__pyx_n_s_meta);
- PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_s_meta);
+ PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_meta);
__Pyx_GIVEREF(__pyx_n_s_meta);
__Pyx_INCREF(__pyx_n_s_online);
- PyList_SET_ITEM(__pyx_t_2, 12, __pyx_n_s_online);
+ PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_s_online);
__Pyx_GIVEREF(__pyx_n_s_online);
-
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":16
- * from online import Bilex
- *
- * FeatureContext = namedtuple('FeatureContext', # <<<<<<<<<<<<<<
- * ['fphrase',
- * 'ephrase',
- */
- __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ if (__pyx_t_4) {
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
+ }
__Pyx_INCREF(__pyx_n_s_FeatureContext);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_FeatureContext);
+ PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_n_s_FeatureContext);
__Pyx_GIVEREF(__pyx_n_s_FeatureContext);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __pyx_t_2 = 0;
- __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_FeatureContext, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_FeatureContext, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":32
+ /* "cdec/sa/rulefactory.pxi":32
* ])
*
* OnlineFeatureContext = namedtuple('OnlineFeatureContext', # <<<<<<<<<<<<<<
@@ -79066,51 +83769,58 @@ PyMODINIT_FUNC PyInit__sa(void)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":33
+ /* "cdec/sa/rulefactory.pxi":33
*
* OnlineFeatureContext = namedtuple('OnlineFeatureContext',
* ['fcount', # <<<<<<<<<<<<<<
* 'fsample_count',
* 'paircount',
*/
- __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = PyList_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_n_s_fcount);
- PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_fcount);
+ PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_fcount);
__Pyx_GIVEREF(__pyx_n_s_fcount);
__Pyx_INCREF(__pyx_n_s_fsample_count);
- PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_fsample_count);
+ PyList_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_fsample_count);
__Pyx_GIVEREF(__pyx_n_s_fsample_count);
__Pyx_INCREF(__pyx_n_s_paircount);
- PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_paircount);
+ PyList_SET_ITEM(__pyx_t_6, 2, __pyx_n_s_paircount);
__Pyx_GIVEREF(__pyx_n_s_paircount);
__Pyx_INCREF(__pyx_n_s_bilex);
- PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_bilex);
+ PyList_SET_ITEM(__pyx_t_6, 3, __pyx_n_s_bilex);
__Pyx_GIVEREF(__pyx_n_s_bilex);
-
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":32
- * ])
- *
- * OnlineFeatureContext = namedtuple('OnlineFeatureContext', # <<<<<<<<<<<<<<
- * ['fcount',
- * 'fsample_count',
- */
- __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = NULL;
+ __pyx_t_5 = 0;
+ if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
+ __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
+ if (likely(__pyx_t_3)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_2, function);
+ __pyx_t_5 = 1;
+ }
+ }
+ __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ if (__pyx_t_3) {
+ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
+ }
__Pyx_INCREF(__pyx_n_s_OnlineFeatureContext);
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OnlineFeatureContext);
+ PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_n_s_OnlineFeatureContext);
__Pyx_GIVEREF(__pyx_n_s_OnlineFeatureContext);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_OnlineFeatureContext, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_OnlineFeatureContext, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":60
+ /* "cdec/sa/rulefactory.pxi":60
* self.bilex = Bilex()
*
* cdef int PRECOMPUTE = 0 # <<<<<<<<<<<<<<
@@ -79119,7 +83829,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_PRECOMPUTE = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":61
+ /* "cdec/sa/rulefactory.pxi":61
*
* cdef int PRECOMPUTE = 0
* cdef int MERGE = 1 # <<<<<<<<<<<<<<
@@ -79128,7 +83838,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_MERGE = 1;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62
+ /* "cdec/sa/rulefactory.pxi":62
* cdef int PRECOMPUTE = 0
* cdef int MERGE = 1
* cdef int BAEZA_YATES = 2 # <<<<<<<<<<<<<<
@@ -79137,7 +83847,7 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_BAEZA_YATES = 2;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":65
+ /* "cdec/sa/rulefactory.pxi":65
*
* # NOTE: was encoded as a non-terminal in the previous version
* cdef int EPSILON = sym_fromstring('*EPS*', True) # <<<<<<<<<<<<<<
@@ -79146,55 +83856,55 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
__pyx_v_4cdec_2sa_3_sa_EPSILON = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_k_EPS, 1);
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188
+ /* "cdec/sa/rulefactory.pxi":2200
*
* # Spans are _inclusive_ on both ends [i, j]
* def span_check(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_17span_check, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_check, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_17span_check, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_check, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196
+ /* "cdec/sa/rulefactory.pxi":2208
* return True
*
* def span_inc(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_19span_inc, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_inc, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_19span_inc, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_inc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202
+ /* "cdec/sa/rulefactory.pxi":2214
* k += 1
*
* def span_dec(vec, i, j): # <<<<<<<<<<<<<<
* k = i
* while k <= j:
*/
- __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_21span_dec, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_dec, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_21span_dec, NULL, __pyx_n_s_cdec_sa__sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_span_dec, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":1
+ /* "cdec/sa/features.pxi":1
* cdef StringMap FD = StringMap() # Feature name dictionary # <<<<<<<<<<<<<<
*
* INITIAL_CAPACITY = 7 # default number of features
*/
- __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(((PyObject *)__pyx_v_4cdec_2sa_3_sa_FD));
- __Pyx_DECREF_SET(__pyx_v_4cdec_2sa_3_sa_FD, ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_3));
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
+ __Pyx_DECREF_SET(__pyx_v_4cdec_2sa_3_sa_FD, ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1));
+ __Pyx_GIVEREF(__pyx_t_1);
+ __pyx_t_1 = 0;
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":3
+ /* "cdec/sa/features.pxi":3
* cdef StringMap FD = StringMap() # Feature name dictionary
*
* INITIAL_CAPACITY = 7 # default number of features # <<<<<<<<<<<<<<
@@ -79203,34 +83913,42 @@ PyMODINIT_FUNC PyInit__sa(void)
*/
if (PyDict_SetItem(__pyx_d, __pyx_n_s_INITIAL_CAPACITY, __pyx_int_7) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "/usr0/home/mdenkows/cdec/python/cdec/sa/features.pxi":4
+ /* "cdec/sa/features.pxi":4
*
* INITIAL_CAPACITY = 7 # default number of features
* INCREMENT = INITIAL_CAPACITY # double size # <<<<<<<<<<<<<<
*
* cdef class FeatureVector:
*/
- __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_INITIAL_CAPACITY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_INCREMENT, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_INITIAL_CAPACITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_INCREMENT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cdec/sa/_sa.pyx":1
* import logging # <<<<<<<<<<<<<<
* import resource
* import gzip
*/
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /*--- Wrapped vars code ---*/
+
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_6);
if (__pyx_m) {
- __Pyx_AddTraceback("init cdec.sa._sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__pyx_d) {
+ __Pyx_AddTraceback("init cdec.sa._sa", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ Py_DECREF(__pyx_d); __pyx_d = 0;
+ }
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init cdec.sa._sa");
@@ -79259,7 +83977,7 @@ end:
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
-#endif /* CYTHON_REFNANNY */
+#endif
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
@@ -79278,7 +83996,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
result = PyDict_GetItem(__pyx_d, name);
- if (result) {
+ if (likely(result)) {
Py_INCREF(result);
} else {
#else
@@ -79297,14 +84015,29 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg
ternaryfunc call = func->ob_type->tp_call;
if (unlikely(!call))
return PyObject_Call(func, arg, kw);
-#if PY_VERSION_HEX >= 0x02060000
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
return NULL;
-#endif
result = (*call)(func, arg, kw);
-#if PY_VERSION_HEX >= 0x02060000
Py_LeaveRecursiveCall();
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
+ PyErr_SetString(
+ PyExc_SystemError,
+ "NULL result without error in PyObject_Call");
+ }
+ return result;
+}
#endif
+
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
+ PyObject *self, *result;
+ PyCFunction cfunc;
+ cfunc = PyCFunction_GET_FUNCTION(func);
+ self = PyCFunction_GET_SELF(func);
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
+ return NULL;
+ result = cfunc(self, arg);
+ Py_LeaveRecursiveCall();
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
PyErr_SetString(
PyExc_SystemError,
@@ -79314,6 +84047,36 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg
}
#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject *result;
+ PyObject *args = PyTuple_New(1);
+ if (unlikely(!args)) return NULL;
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 0, arg);
+ result = __Pyx_PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ return result;
+}
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
+ return __Pyx_PyObject_CallMethO(func, arg);
+ }
+ }
+ return __Pyx__PyObject_CallOneArg(func, arg);
+}
+#else
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
+ PyObject* args = PyTuple_Pack(1, arg);
+ return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
+}
+#endif
+
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
@@ -79502,11 +84265,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
}
- #if PY_VERSION_HEX < 0x02050000
- if (PyClass_Check(type)) {
- #else
if (PyType_Check(type)) {
- #endif
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
@@ -79521,17 +84280,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
goto raise_error;
}
value = type;
- #if PY_VERSION_HEX < 0x02050000
- if (PyInstance_Check(type)) {
- type = (PyObject*) ((PyInstanceObject*)type)->in_class;
- Py_INCREF(type);
- } else {
- type = 0;
- PyErr_SetString(PyExc_TypeError,
- "raise: exception must be an old-style class or instance");
- goto raise_error;
- }
- #else
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
@@ -79539,7 +84287,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
- #endif
}
__Pyx_ErrRestore(type, value, tb);
return;
@@ -79549,7 +84296,7 @@ raise_error:
Py_XDECREF(tb);
return;
}
-#else /* Python 3+ */
+#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
@@ -79695,7 +84442,7 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
{
PyObject* key = 0;
Py_ssize_t pos = 0;
-#if CPYTHON_COMPILING_IN_PYPY
+#if CYTHON_COMPILING_IN_PYPY
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
goto invalid_keyword;
return 1;
@@ -79798,10 +84545,8 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
Py_ssize_t length;
int kind;
void *data1, *data2;
- #if CYTHON_PEP393_ENABLED
- if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
+ if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
return -1;
- #endif
length = __Pyx_PyUnicode_GET_LENGTH(s1);
if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
goto return_ne;
@@ -79817,7 +84562,7 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
} else if (length == 1) {
goto return_eq;
} else {
- int result = memcmp(data1, data2, length * kind);
+ int result = memcmp(data1, data2, (size_t)(length * kind));
#if PY_MAJOR_VERSION < 3
Py_XDECREF(owned_ref);
#endif
@@ -79927,6 +84672,37 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
+ PyObject *method, *result = NULL;
+ method = __Pyx_PyObject_GetAttrStr(obj, method_name);
+ if (unlikely(!method)) goto bad;
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyMethod_Check(method))) {
+ PyObject *self = PyMethod_GET_SELF(method);
+ if (likely(self)) {
+ PyObject *args;
+ PyObject *function = PyMethod_GET_FUNCTION(method);
+ args = PyTuple_New(2);
+ if (unlikely(!args)) goto bad;
+ Py_INCREF(self);
+ PyTuple_SET_ITEM(args, 0, self);
+ Py_INCREF(arg);
+ PyTuple_SET_ITEM(args, 1, arg);
+ Py_INCREF(function);
+ Py_DECREF(method); method = NULL;
+ result = __Pyx_PyObject_Call(function, args, NULL);
+ Py_DECREF(args);
+ Py_DECREF(function);
+ return result;
+ }
+ }
+#endif
+ result = __Pyx_PyObject_CallOneArg(method, arg);
+bad:
+ Py_XDECREF(method);
+ return result;
+}
+
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
@@ -79939,6 +84715,21 @@ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
return 0;
}
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
+#ifdef __Pyx_CyFunction_USED
+ if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
+#else
+ if (likely(PyCFunction_Check(func))) {
+#endif
+ if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
+ return __Pyx_PyObject_CallMethO(func, NULL);
+ }
+ }
+ return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
+}
+#endif
+
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
@@ -80323,169 +85114,9 @@ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, in
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
- return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL)
-}
-#endif
-
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
- PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
-}
-
-static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
- if (t == Py_None) {
- __Pyx_RaiseNoneNotIterableError();
- } else if (PyTuple_GET_SIZE(t) < index) {
- __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
- } else {
- __Pyx_RaiseTooManyValuesError(index);
- }
-}
-
-static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
- int is_tuple, int has_known_size, int decref_tuple) {
- Py_ssize_t index;
- PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
- if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
- iternextfunc iternext;
- iter = PyObject_GetIter(tuple);
- if (unlikely(!iter)) goto bad;
- if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
- iternext = Py_TYPE(iter)->tp_iternext;
- value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
- value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
- if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
- Py_DECREF(iter);
- } else {
- if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
- __Pyx_UnpackTupleError(tuple, 2);
- goto bad;
- }
-#if CYTHON_COMPILING_IN_PYPY
- value1 = PySequence_ITEM(tuple, 0);
- if (unlikely(!value1)) goto bad;
- value2 = PySequence_ITEM(tuple, 1);
- if (unlikely(!value2)) goto bad;
-#else
- value1 = PyTuple_GET_ITEM(tuple, 0);
- value2 = PyTuple_GET_ITEM(tuple, 1);
- Py_INCREF(value1);
- Py_INCREF(value2);
-#endif
- if (decref_tuple) { Py_DECREF(tuple); }
- }
- *pvalue1 = value1;
- *pvalue2 = value2;
- return 0;
-unpacking_failed:
- if (!has_known_size && __Pyx_IterFinish() == 0)
- __Pyx_RaiseNeedMoreValuesError(index);
-bad:
- Py_XDECREF(iter);
- Py_XDECREF(value1);
- Py_XDECREF(value2);
- if (decref_tuple) { Py_XDECREF(tuple); }
- return -1;
-}
-
-static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
- Py_ssize_t* p_orig_length, int* p_source_is_dict) {
- is_dict = is_dict || likely(PyDict_CheckExact(iterable));
- *p_source_is_dict = is_dict;
-#if !CYTHON_COMPILING_IN_PYPY
- if (is_dict) {
- *p_orig_length = PyDict_Size(iterable);
- Py_INCREF(iterable);
- return iterable;
- }
-#endif
- *p_orig_length = 0;
- if (method_name) {
- PyObject* iter;
- iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
- if (!iterable)
- return NULL;
-#if !CYTHON_COMPILING_IN_PYPY
- if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
- return iterable;
-#endif
- iter = PyObject_GetIter(iterable);
- Py_DECREF(iterable);
- return iter;
- }
- return PyObject_GetIter(iterable);
+ return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
-static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
- PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
- PyObject* next_item;
-#if !CYTHON_COMPILING_IN_PYPY
- if (source_is_dict) {
- PyObject *key, *value;
- if (unlikely(orig_length != PyDict_Size(iter_obj))) {
- PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
- return -1;
- }
- if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
- return 0;
- }
- if (pitem) {
- PyObject* tuple = PyTuple_New(2);
- if (unlikely(!tuple)) {
- return -1;
- }
- Py_INCREF(key);
- Py_INCREF(value);
- PyTuple_SET_ITEM(tuple, 0, key);
- PyTuple_SET_ITEM(tuple, 1, value);
- *pitem = tuple;
- } else {
- if (pkey) {
- Py_INCREF(key);
- *pkey = key;
- }
- if (pvalue) {
- Py_INCREF(value);
- *pvalue = value;
- }
- }
- return 1;
- } else if (PyTuple_CheckExact(iter_obj)) {
- Py_ssize_t pos = *ppos;
- if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
- *ppos = pos + 1;
- next_item = PyTuple_GET_ITEM(iter_obj, pos);
- Py_INCREF(next_item);
- } else if (PyList_CheckExact(iter_obj)) {
- Py_ssize_t pos = *ppos;
- if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
- *ppos = pos + 1;
- next_item = PyList_GET_ITEM(iter_obj, pos);
- Py_INCREF(next_item);
- } else
#endif
- {
- next_item = PyIter_Next(iter_obj);
- if (unlikely(!next_item)) {
- return __Pyx_IterFinish();
- }
- }
- if (pitem) {
- *pitem = next_item;
- } else if (pkey && pvalue) {
- if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
- return -1;
- } else if (pkey) {
- *pkey = next_item;
- } else {
- *pvalue = next_item;
- }
- return 1;
-}
-
-static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
- long r = a % b;
- r += ((r != 0) & ((r ^ b) < 0)) * b;
- return r;
-}
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
PyObject* fake_module;
@@ -80549,8 +85180,9 @@ static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
- if (value == NULL)
- value = Py_None; /* Mark as deleted */
+ if (value == NULL) {
+ value = Py_None;
+ }
Py_INCREF(value);
op->func_doc = value;
Py_XDECREF(tmp);
@@ -80795,7 +85427,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
{0, 0, 0, 0, 0}
};
-#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
+#ifndef PY_WRITE_RESTRICTED
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
@@ -80812,16 +85444,21 @@ __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
- {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
+ {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
+#if PY_VERSION_HEX < 0x030500A0
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
+#else
+#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
+#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
- op->func_weakreflist = NULL;
+ __Pyx_CyFunction_weakreflist(op) = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
@@ -80875,7 +85512,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
- if (m->func_weakreflist != NULL)
+ if (__Pyx_CyFunction_weakreflist(m) != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
@@ -80981,60 +85618,62 @@ static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
- sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "cython_function_or_method",
+ sizeof(__pyx_CyFunctionObject),
+ 0,
+ (destructor) __Pyx_CyFunction_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
#else
- 0, /*reserved*/
+ 0,
#endif
- (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- __Pyx_CyFunction_Call, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
- (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_CyFunction_methods, /*tp_methods*/
- __pyx_CyFunction_members, /*tp_members*/
- __pyx_CyFunction_getsets, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- __Pyx_CyFunction_descr_get, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ (reprfunc) __Pyx_CyFunction_repr,
+ 0,
+ 0,
+ 0,
+ 0,
+ __Pyx_CyFunction_Call,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
+ 0,
+ (traverseproc) __Pyx_CyFunction_traverse,
+ (inquiry) __Pyx_CyFunction_clear,
+ 0,
+#if PY_VERSION_HEX < 0x030500A0
+ offsetof(__pyx_CyFunctionObject, func_weakreflist),
+#else
+ offsetof(PyCFunctionObject, m_weakreflist),
#endif
+ 0,
+ 0,
+ __pyx_CyFunction_methods,
+ __pyx_CyFunction_members,
+ __pyx_CyFunction_getsets,
+ 0,
+ 0,
+ __Pyx_CyFunction_descr_get,
+ 0,
+ offsetof(__pyx_CyFunctionObject, func_dict),
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
#if PY_VERSION_HEX >= 0x030400a1
- 0, /*tp_finalize*/
+ 0,
#endif
};
static int __Pyx_CyFunction_init(void) {
@@ -81072,8 +85711,189 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py
Py_INCREF(dict);
}
+static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
+ PyObject *method, *result = NULL;
+ method = __Pyx_PyObject_GetAttrStr(obj, method_name);
+ if (unlikely(!method)) goto bad;
+#if CYTHON_COMPILING_IN_CPYTHON
+ if (likely(PyMethod_Check(method))) {
+ PyObject *self = PyMethod_GET_SELF(method);
+ if (likely(self)) {
+ PyObject *function = PyMethod_GET_FUNCTION(method);
+ result = __Pyx_PyObject_CallOneArg(function, self);
+ Py_DECREF(method);
+ return result;
+ }
+ }
+#endif
+ result = __Pyx_PyObject_CallNoArg(method);
+ Py_DECREF(method);
+bad:
+ return result;
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+}
+
+static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
+ if (t == Py_None) {
+ __Pyx_RaiseNoneNotIterableError();
+ } else if (PyTuple_GET_SIZE(t) < index) {
+ __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
+ } else {
+ __Pyx_RaiseTooManyValuesError(index);
+ }
+}
+
+static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
+ int is_tuple, int has_known_size, int decref_tuple) {
+ Py_ssize_t index;
+ PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
+ if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
+ iternextfunc iternext;
+ iter = PyObject_GetIter(tuple);
+ if (unlikely(!iter)) goto bad;
+ if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
+ iternext = Py_TYPE(iter)->tp_iternext;
+ value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
+ value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
+ if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
+ Py_DECREF(iter);
+ } else {
+ if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
+ __Pyx_UnpackTupleError(tuple, 2);
+ goto bad;
+ }
+#if CYTHON_COMPILING_IN_PYPY
+ value1 = PySequence_ITEM(tuple, 0);
+ if (unlikely(!value1)) goto bad;
+ value2 = PySequence_ITEM(tuple, 1);
+ if (unlikely(!value2)) goto bad;
+#else
+ value1 = PyTuple_GET_ITEM(tuple, 0);
+ value2 = PyTuple_GET_ITEM(tuple, 1);
+ Py_INCREF(value1);
+ Py_INCREF(value2);
+#endif
+ if (decref_tuple) { Py_DECREF(tuple); }
+ }
+ *pvalue1 = value1;
+ *pvalue2 = value2;
+ return 0;
+unpacking_failed:
+ if (!has_known_size && __Pyx_IterFinish() == 0)
+ __Pyx_RaiseNeedMoreValuesError(index);
+bad:
+ Py_XDECREF(iter);
+ Py_XDECREF(value1);
+ Py_XDECREF(value2);
+ if (decref_tuple) { Py_XDECREF(tuple); }
+ return -1;
+}
+
+static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
+ Py_ssize_t* p_orig_length, int* p_source_is_dict) {
+ is_dict = is_dict || likely(PyDict_CheckExact(iterable));
+ *p_source_is_dict = is_dict;
+#if !CYTHON_COMPILING_IN_PYPY
+ if (is_dict) {
+ *p_orig_length = PyDict_Size(iterable);
+ Py_INCREF(iterable);
+ return iterable;
+ }
+#endif
+ *p_orig_length = 0;
+ if (method_name) {
+ PyObject* iter;
+ iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
+ if (!iterable)
+ return NULL;
+#if !CYTHON_COMPILING_IN_PYPY
+ if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
+ return iterable;
+#endif
+ iter = PyObject_GetIter(iterable);
+ Py_DECREF(iterable);
+ return iter;
+ }
+ return PyObject_GetIter(iterable);
+}
+static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t orig_length, Py_ssize_t* ppos,
+ PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
+ PyObject* next_item;
+#if !CYTHON_COMPILING_IN_PYPY
+ if (source_is_dict) {
+ PyObject *key, *value;
+ if (unlikely(orig_length != PyDict_Size(iter_obj))) {
+ PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
+ return -1;
+ }
+ if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
+ return 0;
+ }
+ if (pitem) {
+ PyObject* tuple = PyTuple_New(2);
+ if (unlikely(!tuple)) {
+ return -1;
+ }
+ Py_INCREF(key);
+ Py_INCREF(value);
+ PyTuple_SET_ITEM(tuple, 0, key);
+ PyTuple_SET_ITEM(tuple, 1, value);
+ *pitem = tuple;
+ } else {
+ if (pkey) {
+ Py_INCREF(key);
+ *pkey = key;
+ }
+ if (pvalue) {
+ Py_INCREF(value);
+ *pvalue = value;
+ }
+ }
+ return 1;
+ } else if (PyTuple_CheckExact(iter_obj)) {
+ Py_ssize_t pos = *ppos;
+ if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
+ *ppos = pos + 1;
+ next_item = PyTuple_GET_ITEM(iter_obj, pos);
+ Py_INCREF(next_item);
+ } else if (PyList_CheckExact(iter_obj)) {
+ Py_ssize_t pos = *ppos;
+ if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
+ *ppos = pos + 1;
+ next_item = PyList_GET_ITEM(iter_obj, pos);
+ Py_INCREF(next_item);
+ } else
+#endif
+ {
+ next_item = PyIter_Next(iter_obj);
+ if (unlikely(!next_item)) {
+ return __Pyx_IterFinish();
+ }
+ }
+ if (pitem) {
+ *pitem = next_item;
+ } else if (pkey && pvalue) {
+ if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
+ return -1;
+ } else if (pkey) {
+ *pkey = next_item;
+ } else {
+ *pvalue = next_item;
+ }
+ return 1;
+}
+
+static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
+ long r = a % b;
+ r += ((r != 0) & ((r ^ b) < 0)) * b;
+ return r;
+}
+
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02050000
+#if CYTHON_COMPILING_IN_CPYTHON
if (Py_TYPE(L) == &PySet_Type) {
return PySet_Pop(L);
}
@@ -81081,7 +85901,7 @@ static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
+#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
Py_SIZE(L) -= 1;
return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
@@ -81090,15 +85910,14 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
return __Pyx_PyObject_CallMethod0(L, __pyx_n_s_pop);
}
-static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
- PyObject *r, *py_ix;
- py_ix = PyInt_FromSsize_t(ix);
- if (!py_ix) return NULL;
+static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) {
+ PyObject *r;
+ if (unlikely(!py_ix)) return NULL;
r = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_pop, py_ix);
Py_DECREF(py_ix);
return r;
}
-static PyObject* __Pyx_PyList_PopIndex(PyObject* L, Py_ssize_t ix) {
+static PyObject* __Pyx__PyList_PopIndex(PyObject* L, Py_ssize_t ix) {
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = PyList_GET_SIZE(L);
if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
@@ -81110,16 +85929,16 @@ static PyObject* __Pyx_PyList_PopIndex(PyObject* L, Py_ssize_t ix) {
PyObject* v = PyList_GET_ITEM(L, cix);
Py_SIZE(L) -= 1;
size -= 1;
- memmove(&PyList_GET_ITEM(L, cix), &PyList_GET_ITEM(L, cix+1), (size-cix)*sizeof(PyObject*));
+ memmove(&PyList_GET_ITEM(L, cix), &PyList_GET_ITEM(L, cix+1), (size_t)(size-cix)*sizeof(PyObject*));
return v;
}
}
#endif
- return __Pyx__PyObject_PopIndex(L, ix);
+ return __Pyx__PyObject_PopIndex(L, PyInt_FromSsize_t(ix));
}
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
@@ -81148,6 +85967,165 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
return value;
}
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
+ int start = 0, mid = 0, end = count - 1;
+ if (end >= 0 && code_line > entries[end].code_line) {
+ return count;
+ }
+ while (start < end) {
+ mid = (start + end) / 2;
+ if (code_line < entries[mid].code_line) {
+ end = mid;
+ } else if (code_line > entries[mid].code_line) {
+ start = mid + 1;
+ } else {
+ return mid;
+ }
+ }
+ if (code_line <= entries[mid].code_line) {
+ return mid;
+ } else {
+ return mid + 1;
+ }
+}
+static PyCodeObject *__pyx_find_code_object(int code_line) {
+ PyCodeObject* code_object;
+ int pos;
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
+ return NULL;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
+ return NULL;
+ }
+ code_object = __pyx_code_cache.entries[pos].code_object;
+ Py_INCREF(code_object);
+ return code_object;
+}
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
+ int pos, i;
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
+ if (unlikely(!code_line)) {
+ return;
+ }
+ if (unlikely(!entries)) {
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (likely(entries)) {
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = 64;
+ __pyx_code_cache.count = 1;
+ entries[0].code_line = code_line;
+ entries[0].code_object = code_object;
+ Py_INCREF(code_object);
+ }
+ return;
+ }
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
+ PyCodeObject* tmp = entries[pos].code_object;
+ entries[pos].code_object = code_object;
+ Py_DECREF(tmp);
+ return;
+ }
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
+ int new_max = __pyx_code_cache.max_count + 64;
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
+ __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
+ if (unlikely(!entries)) {
+ return;
+ }
+ __pyx_code_cache.entries = entries;
+ __pyx_code_cache.max_count = new_max;
+ }
+ for (i=__pyx_code_cache.count; i>pos; i--) {
+ entries[i] = entries[i-1];
+ }
+ entries[pos].code_line = code_line;
+ entries[pos].code_object = code_object;
+ __pyx_code_cache.count++;
+ Py_INCREF(code_object);
+}
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
+ const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyObject *py_srcfile = 0;
+ PyObject *py_funcname = 0;
+ #if PY_MAJOR_VERSION < 3
+ py_srcfile = PyString_FromString(filename);
+ #else
+ py_srcfile = PyUnicode_FromString(filename);
+ #endif
+ if (!py_srcfile) goto bad;
+ if (c_line) {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #else
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
+ #endif
+ }
+ else {
+ #if PY_MAJOR_VERSION < 3
+ py_funcname = PyString_FromString(funcname);
+ #else
+ py_funcname = PyUnicode_FromString(funcname);
+ #endif
+ }
+ if (!py_funcname) goto bad;
+ py_code = __Pyx_PyCode_New(
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ __pyx_empty_bytes, /*PyObject *code,*/
+ __pyx_empty_tuple, /*PyObject *consts,*/
+ __pyx_empty_tuple, /*PyObject *names,*/
+ __pyx_empty_tuple, /*PyObject *varnames,*/
+ __pyx_empty_tuple, /*PyObject *freevars,*/
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
+ py_srcfile, /*PyObject *filename,*/
+ py_funcname, /*PyObject *name,*/
+ py_line,
+ __pyx_empty_bytes /*PyObject *lnotab*/
+ );
+ Py_DECREF(py_srcfile);
+ Py_DECREF(py_funcname);
+ return py_code;
+bad:
+ Py_XDECREF(py_srcfile);
+ Py_XDECREF(py_funcname);
+ return NULL;
+}
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename) {
+ PyCodeObject *py_code = 0;
+ PyFrameObject *py_frame = 0;
+ py_code = __pyx_find_code_object(c_line ? c_line : py_line);
+ if (!py_code) {
+ py_code = __Pyx_CreateCodeObjectForTraceback(
+ funcname, c_line, py_line, filename);
+ if (!py_code) goto bad;
+ __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
+ }
+ py_frame = PyFrame_New(
+ PyThreadState_GET(), /*PyThreadState *tstate,*/
+ py_code, /*PyCodeObject *code,*/
+ __pyx_d, /*PyObject *globals,*/
+ 0 /*PyObject *locals*/
+ );
+ if (!py_frame) goto bad;
+ py_frame->f_lineno = py_line;
+ PyTraceBack_Here(py_frame);
+bad:
+ Py_XDECREF(py_code);
+ Py_XDECREF(py_frame);
+}
+
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
const int neg_one = (int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
@@ -81174,17 +86152,16 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
}
}
-#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \
+#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
{ \
- func_type value = func(x); \
+ func_type value = func_value; \
if (sizeof(target_type) < sizeof(func_type)) { \
if (unlikely(value != (func_type) (target_type) value)) { \
func_type zero = 0; \
- PyErr_SetString(PyExc_OverflowError, \
- (is_unsigned && unlikely(value < zero)) ? \
- "can't convert negative value to " #target_type : \
- "value too large to convert to " #target_type); \
- return (target_type) -1; \
+ if (is_unsigned && unlikely(value < zero)) \
+ goto raise_neg_overflow; \
+ else \
+ goto raise_overflow; \
} \
} \
return (target_type) value; \
@@ -81195,19 +86172,18 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
#include "longintrepr.h"
#endif
#endif
+
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
const int neg_one = (int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(int) < sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to int");
- return (int) -1;
+ goto raise_neg_overflow;
}
return (int) val;
}
@@ -81217,40 +86193,34 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(int)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (int) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to int");
- return (int) -1;
+ goto raise_neg_overflow;
}
if (sizeof(int) <= sizeof(unsigned long)) {
- __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(int) <= sizeof(unsigned long long)) {
- __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
+ __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(int)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(int) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (sizeof(int) <= sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
+ __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
} else if (sizeof(int) <= sizeof(long long)) {
- __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
+ __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
}
}
{
@@ -81288,6 +86258,14 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to int");
+ return (int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to int");
+ return (int) -1;
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
@@ -81316,7 +86294,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
- #if PY_VERSION_HEX >= 0x02050000
{
#if PY_MAJOR_VERSION >= 3
if (level == -1) {
@@ -81338,7 +86315,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
PyErr_Clear();
}
}
- level = 0; /* try absolute import on failure */
+ level = 0;
}
#endif
if (!module) {
@@ -81355,14 +86332,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
#endif
}
}
- #else
- if (level>0) {
- PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
- goto bad;
- }
- module = PyObject_CallFunctionObjArgs(py_import,
- name, global_dict, empty_dict, list, NULL);
- #endif
bad:
#if PY_VERSION_HEX < 0x03030000
Py_XDECREF(py_import);
@@ -81372,24 +86341,17 @@ bad:
return module;
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
- #if CYTHON_USE_PYLONG_INTERNALS
- #include "longintrepr.h"
- #endif
-#endif
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(unsigned int) < sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG)
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned int");
- return (unsigned int) -1;
+ goto raise_neg_overflow;
}
return (unsigned int) val;
}
@@ -81399,40 +86361,34 @@ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned int)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (unsigned int) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to unsigned int");
- return (unsigned int) -1;
+ goto raise_neg_overflow;
}
if (sizeof(unsigned int) <= sizeof(unsigned long)) {
- __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong)
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
- __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong)
+ __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(unsigned int)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(unsigned int) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(unsigned int) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (sizeof(unsigned int) <= sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong)
+ __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x))
} else if (sizeof(unsigned int) <= sizeof(long long)) {
- __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong)
+ __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x))
}
}
{
@@ -81470,6 +86426,14 @@ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to unsigned int");
+ return (unsigned int) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to unsigned int");
+ return (unsigned int) -1;
}
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
@@ -81524,24 +86488,17 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
}
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
- #if CYTHON_USE_PYLONG_INTERNALS
- #include "longintrepr.h"
- #endif
-#endif
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
const long neg_one = (long) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
if (likely(PyInt_Check(x))) {
if (sizeof(long) < sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
} else {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to long");
- return (long) -1;
+ goto raise_neg_overflow;
}
return (long) val;
}
@@ -81551,40 +86508,34 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (unlikely(Py_SIZE(x) < 0)) {
- PyErr_SetString(PyExc_OverflowError,
- "can't convert negative value to long");
- return (long) -1;
+ goto raise_neg_overflow;
}
if (sizeof(long) <= sizeof(unsigned long)) {
- __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
} else if (sizeof(long) <= sizeof(unsigned long long)) {
- __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
+ __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
}
} else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
- if (sizeof(digit) <= sizeof(long)) {
- switch (Py_SIZE(x)) {
- case 0: return 0;
- case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
- case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
- }
+ switch (Py_SIZE(x)) {
+ case 0: return 0;
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
}
#endif
#endif
if (sizeof(long) <= sizeof(long)) {
- __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
+ __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
} else if (sizeof(long) <= sizeof(long long)) {
- __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
+ __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
}
}
{
@@ -81622,6 +86573,14 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
Py_DECREF(tmp);
return val;
}
+raise_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "value too large to convert to long");
+ return (long) -1;
+raise_neg_overflow:
+ PyErr_SetString(PyExc_OverflowError,
+ "can't convert negative value to long");
+ return (long) -1;
}
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
@@ -81749,8 +86708,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
if (value) {
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Generators always return to their most recent caller, not
- * necessarily their creator. */
if (self->exc_traceback) {
PyThreadState *tstate = PyThreadState_GET();
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
@@ -81773,9 +86730,6 @@ PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) {
&self->exc_traceback);
#if CYTHON_COMPILING_IN_PYPY
#else
- /* Don't keep the reference to f_back any longer than necessary. It
- * may keep a chain of frames alive or it could create a reference
- * cycle. */
if (self->exc_traceback) {
PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback;
PyFrameObject *f = tb->tb_frame;
@@ -81879,11 +86833,7 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
Py_DECREF(yf);
}
if (err == 0)
-#if PY_VERSION_HEX < 0x02050000
- PyErr_SetNone(PyExc_StopIteration);
-#else
PyErr_SetNone(PyExc_GeneratorExit);
-#endif
retval = __Pyx_Generator_SendEx(gen, NULL);
if (retval) {
Py_DECREF(retval);
@@ -81894,13 +86844,11 @@ static PyObject *__Pyx_Generator_Close(PyObject *self) {
raised_exception = PyErr_Occurred();
if (!raised_exception
|| raised_exception == PyExc_StopIteration
-#if PY_VERSION_HEX >= 0x02050000
|| raised_exception == PyExc_GeneratorExit
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit)
-#endif
|| PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration))
{
- if (raised_exception) PyErr_Clear(); /* ignore these errors */
+ if (raised_exception) PyErr_Clear();
Py_INCREF(Py_None);
return Py_None;
}
@@ -81919,7 +86867,6 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
if (yf) {
PyObject *ret;
Py_INCREF(yf);
-#if PY_VERSION_HEX >= 0x02050000
if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) {
int err = __Pyx_Generator_CloseIter(gen, yf);
Py_DECREF(yf);
@@ -81928,7 +86875,6 @@ static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) {
return __Pyx_Generator_SendEx(gen, NULL);
goto throw_here;
}
-#endif
gen->is_running = 1;
if (__Pyx_Generator_CheckExact(yf)) {
ret = __Pyx_Generator_Throw(yf, args);
@@ -81977,6 +86923,8 @@ static int __Pyx_Generator_clear(PyObject *self) {
Py_CLEAR(gen->exc_type);
Py_CLEAR(gen->exc_value);
Py_CLEAR(gen->exc_traceback);
+ Py_CLEAR(gen->gi_name);
+ Py_CLEAR(gen->gi_qualname);
return 0;
}
static void __Pyx_Generator_dealloc(PyObject *self) {
@@ -81992,7 +86940,9 @@ static void __Pyx_Generator_dealloc(PyObject *self) {
Py_TYPE(gen)->tp_del(self);
if (self->ob_refcnt > 0)
#endif
- return; /* resurrected. :( */
+ {
+ return;
+ }
PyObject_GC_UnTrack(self);
}
__Pyx_Generator_clear(self);
@@ -82016,15 +86966,10 @@ static void __Pyx_Generator_del(PyObject *self) {
Py_DECREF(res);
__Pyx_ErrRestore(error_type, error_value, error_traceback);
#if PY_VERSION_HEX < 0x030400a1
- /* Undo the temporary resurrection; can't use DECREF here, it would
- * cause a recursive call.
- */
assert(self->ob_refcnt > 0);
- if (--self->ob_refcnt == 0)
- return; /* this is the normal path out */
- /* close() resurrected it! Make it look like the original Py_DECREF
- * never happened.
- */
+ if (--self->ob_refcnt == 0) {
+ return;
+ }
{
Py_ssize_t refcnt = self->ob_refcnt;
_Py_NewReference(self);
@@ -82033,104 +86978,143 @@ static void __Pyx_Generator_del(PyObject *self) {
#if CYTHON_COMPILING_IN_CPYTHON
assert(PyType_IS_GC(self->ob_type) &&
_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
- /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
- * we need to undo that. */
_Py_DEC_REFTOTAL;
#endif
- /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object
- * chain, so no more to do there.
- * If COUNT_ALLOCS, the original decref bumped tp_frees, and
- * _Py_NewReference bumped tp_allocs: both of those need to be
- * undone.
- */
#ifdef COUNT_ALLOCS
--Py_TYPE(self)->tp_frees;
--Py_TYPE(self)->tp_allocs;
#endif
#endif
}
-static PyMemberDef __pyx_Generator_memberlist[] = {
- {(char *) "gi_running",
-#if PY_VERSION_HEX >= 0x02060000
- T_BOOL,
+static PyObject *
+__Pyx_Generator_get_name(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_name);
+ return self->gi_name;
+}
+static int
+__Pyx_Generator_set_name(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
+#else
+ if (unlikely(value == NULL || !PyString_Check(value))) {
+#endif
+ PyErr_SetString(PyExc_TypeError,
+ "__name__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_name;
+ Py_INCREF(value);
+ self->gi_name = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyObject *
+__Pyx_Generator_get_qualname(__pyx_GeneratorObject *self)
+{
+ Py_INCREF(self->gi_qualname);
+ return self->gi_qualname;
+}
+static int
+__Pyx_Generator_set_qualname(__pyx_GeneratorObject *self, PyObject *value)
+{
+ PyObject *tmp;
+#if PY_MAJOR_VERSION >= 3
+ if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
- T_BYTE,
+ if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
- offsetof(__pyx_GeneratorObject, is_running),
- READONLY,
- NULL},
+ PyErr_SetString(PyExc_TypeError,
+ "__qualname__ must be set to a string object");
+ return -1;
+ }
+ tmp = self->gi_qualname;
+ Py_INCREF(value);
+ self->gi_qualname = value;
+ Py_XDECREF(tmp);
+ return 0;
+}
+static PyGetSetDef __pyx_Generator_getsets[] = {
+ {(char *) "__name__", (getter)__Pyx_Generator_get_name, (setter)__Pyx_Generator_set_name,
+ (char*) PyDoc_STR("name of the generator"), 0},
+ {(char *) "__qualname__", (getter)__Pyx_Generator_get_qualname, (setter)__Pyx_Generator_set_qualname,
+ (char*) PyDoc_STR("qualified name of the generator"), 0},
+ {0, 0, 0, 0, 0}
+};
+static PyMemberDef __pyx_Generator_memberlist[] = {
+ {(char *) "gi_running", T_BOOL, offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL},
{0, 0, 0, 0, 0}
};
static PyMethodDef __pyx_Generator_methods[] = {
- {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
- {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
- {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
+ {"send", (PyCFunction) __Pyx_Generator_Send, METH_O, 0},
+ {"throw", (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0},
+ {"close", (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0},
{0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("generator"), /*tp_name*/
- sizeof(__pyx_GeneratorObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
+ "generator",
+ sizeof(__pyx_GeneratorObject),
+ 0,
+ (destructor) __Pyx_Generator_dealloc,
+ 0,
+ 0,
+ 0,
#if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
+ 0,
#else
- 0, /*reserved*/
+ 0,
#endif
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, /* tp_flags*/
- 0, /*tp_doc*/
- (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */
- 0, /*tp_iter*/
- (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/
- __pyx_Generator_methods, /*tp_methods*/
- __pyx_Generator_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
+ 0,
+ (traverseproc) __Pyx_Generator_traverse,
+ 0,
+ 0,
+ offsetof(__pyx_GeneratorObject, gi_weakreflist),
+ 0,
+ (iternextfunc) __Pyx_Generator_Next,
+ __pyx_Generator_methods,
+ __pyx_Generator_memberlist,
+ __pyx_Generator_getsets,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
#if PY_VERSION_HEX >= 0x030400a1
- 0, /*tp_del*/
+ 0,
#else
- __Pyx_Generator_del, /*tp_del*/
-#endif
-#if PY_VERSION_HEX >= 0x02060000
- 0, /*tp_version_tag*/
+ __Pyx_Generator_del,
#endif
+ 0,
#if PY_VERSION_HEX >= 0x030400a1
- __Pyx_Generator_del, /*tp_finalize*/
+ __Pyx_Generator_del,
#endif
};
static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
- PyObject *closure) {
+ PyObject *closure, PyObject *name, PyObject *qualname) {
__pyx_GeneratorObject *gen =
PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type);
if (gen == NULL)
@@ -82146,6 +87130,10 @@ static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body,
gen->exc_value = NULL;
gen->exc_traceback = NULL;
gen->gi_weakreflist = NULL;
+ Py_XINCREF(qualname);
+ gen->gi_qualname = qualname;
+ Py_XINCREF(name);
+ gen->gi_name = name;
PyObject_GC_Track(gen);
return gen;
}
@@ -82169,11 +87157,7 @@ static int __Pyx_check_binary_version(void) {
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
- #if PY_VERSION_HEX < 0x02050000
- return PyErr_Warn(NULL, message);
- #else
return PyErr_WarnEx(NULL, message, 1);
- #endif
}
return 0;
}
@@ -82196,7 +87180,7 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s
goto bad;
}
tmp.fp = f;
-#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
+#if PY_VERSION_HEX >= 0x02070000
cobj = PyCapsule_New(tmp.p, sig, 0);
#else
cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
@@ -82214,168 +87198,6 @@ bad:
return -1;
}
-static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
- int start = 0, mid = 0, end = count - 1;
- if (end >= 0 && code_line > entries[end].code_line) {
- return count;
- }
- while (start < end) {
- mid = (start + end) / 2;
- if (code_line < entries[mid].code_line) {
- end = mid;
- } else if (code_line > entries[mid].code_line) {
- start = mid + 1;
- } else {
- return mid;
- }
- }
- if (code_line <= entries[mid].code_line) {
- return mid;
- } else {
- return mid + 1;
- }
-}
-static PyCodeObject *__pyx_find_code_object(int code_line) {
- PyCodeObject* code_object;
- int pos;
- if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
- return NULL;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
- return NULL;
- }
- code_object = __pyx_code_cache.entries[pos].code_object;
- Py_INCREF(code_object);
- return code_object;
-}
-static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
- int pos, i;
- __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
- if (unlikely(!code_line)) {
- return;
- }
- if (unlikely(!entries)) {
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
- if (likely(entries)) {
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = 64;
- __pyx_code_cache.count = 1;
- entries[0].code_line = code_line;
- entries[0].code_object = code_object;
- Py_INCREF(code_object);
- }
- return;
- }
- pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
- if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
- PyCodeObject* tmp = entries[pos].code_object;
- entries[pos].code_object = code_object;
- Py_DECREF(tmp);
- return;
- }
- if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
- int new_max = __pyx_code_cache.max_count + 64;
- entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
- __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
- if (unlikely(!entries)) {
- return;
- }
- __pyx_code_cache.entries = entries;
- __pyx_code_cache.max_count = new_max;
- }
- for (i=__pyx_code_cache.count; i>pos; i--) {
- entries[i] = entries[i-1];
- }
- entries[pos].code_line = code_line;
- entries[pos].code_object = code_object;
- __pyx_code_cache.count++;
- Py_INCREF(code_object);
-}
-
-#include "compile.h"
-#include "frameobject.h"
-#include "traceback.h"
-static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
- const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_srcfile = 0;
- PyObject *py_funcname = 0;
- #if PY_MAJOR_VERSION < 3
- py_srcfile = PyString_FromString(filename);
- #else
- py_srcfile = PyUnicode_FromString(filename);
- #endif
- if (!py_srcfile) goto bad;
- if (c_line) {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #else
- py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
- #endif
- }
- else {
- #if PY_MAJOR_VERSION < 3
- py_funcname = PyString_FromString(funcname);
- #else
- py_funcname = PyUnicode_FromString(funcname);
- #endif
- }
- if (!py_funcname) goto bad;
- py_code = __Pyx_PyCode_New(
- 0, /*int argcount,*/
- 0, /*int kwonlyargcount,*/
- 0, /*int nlocals,*/
- 0, /*int stacksize,*/
- 0, /*int flags,*/
- __pyx_empty_bytes, /*PyObject *code,*/
- __pyx_empty_tuple, /*PyObject *consts,*/
- __pyx_empty_tuple, /*PyObject *names,*/
- __pyx_empty_tuple, /*PyObject *varnames,*/
- __pyx_empty_tuple, /*PyObject *freevars,*/
- __pyx_empty_tuple, /*PyObject *cellvars,*/
- py_srcfile, /*PyObject *filename,*/
- py_funcname, /*PyObject *name,*/
- py_line, /*int firstlineno,*/
- __pyx_empty_bytes /*PyObject *lnotab*/
- );
- Py_DECREF(py_srcfile);
- Py_DECREF(py_funcname);
- return py_code;
-bad:
- Py_XDECREF(py_srcfile);
- Py_XDECREF(py_funcname);
- return NULL;
-}
-static void __Pyx_AddTraceback(const char *funcname, int c_line,
- int py_line, const char *filename) {
- PyCodeObject *py_code = 0;
- PyObject *py_globals = 0;
- PyFrameObject *py_frame = 0;
- py_code = __pyx_find_code_object(c_line ? c_line : py_line);
- if (!py_code) {
- py_code = __Pyx_CreateCodeObjectForTraceback(
- funcname, c_line, py_line, filename);
- if (!py_code) goto bad;
- __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
- }
- py_globals = PyModule_GetDict(__pyx_m);
- if (!py_globals) goto bad;
- py_frame = PyFrame_New(
- PyThreadState_GET(), /*PyThreadState *tstate,*/
- py_code, /*PyCodeObject *code,*/
- py_globals, /*PyObject *globals,*/
- 0 /*PyObject *locals*/
- );
- if (!py_frame) goto bad;
- py_frame->f_lineno = py_line;
- PyTraceBack_Here(py_frame);
-bad:
- Py_XDECREF(py_code);
- Py_XDECREF(py_frame);
-}
-
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
@@ -82386,7 +87208,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
- #else /* Python 3+ has unicode identifiers */
+ #else
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
@@ -82406,8 +87228,8 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
return 0;
}
-static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
- return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
Py_ssize_t ignore;
@@ -82436,33 +87258,31 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_
}
}
}
-#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
+#endif
*length = PyBytes_GET_SIZE(defenc);
return defenc_c;
-#else /* PY_VERSION_HEX < 0x03030000 */
- if (PyUnicode_READY(o) == -1) return NULL;
+#else
+ if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
if (PyUnicode_IS_ASCII(o)) {
- *length = PyUnicode_GET_DATA_SIZE(o);
+ *length = PyUnicode_GET_LENGTH(o);
return PyUnicode_AsUTF8(o);
} else {
PyUnicode_AsASCIIString(o);
return NULL;
}
-#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
+#else
return PyUnicode_AsUTF8AndSize(o, length);
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
-#endif /* PY_VERSION_HEX < 0x03030000 */
+#endif
+#endif
} else
-#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
+#endif
#if !CYTHON_COMPILING_IN_PYPY
-#if PY_VERSION_HEX >= 0x02060000
if (PyByteArray_Check(o)) {
*length = PyByteArray_GET_SIZE(o);
return PyByteArray_AS_STRING(o);
} else
#endif
-#endif
{
char* result;
int r = PyBytes_AsStringAndSize(o, &result, length);
@@ -82523,11 +87343,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
}
return res;
}
-#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
- #if CYTHON_USE_PYLONG_INTERNALS
- #include "longintrepr.h"
- #endif
-#endif
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject *x;
@@ -82545,11 +87360,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
}
#endif
#endif
- #if PY_VERSION_HEX < 0x02060000
- return PyInt_AsSsize_t(b);
- #else
return PyLong_AsSsize_t(b);
- #endif
}
x = PyNumber_Index(b);
if (!x) return -1;
@@ -82558,17 +87369,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
-#if PY_VERSION_HEX < 0x02050000
- if (ival <= LONG_MAX)
- return PyInt_FromLong((long)ival);
- else {
- unsigned char *bytes = (unsigned char *) &ival;
- int one = 1; int little = (int)*(unsigned char*)&one;
- return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
- }
-#else
- return PyInt_FromSize_t(ival);
-#endif
+ return PyInt_FromSize_t(ival);
}
diff --git a/python/cdec/sa/_sa.pxd b/python/cdec/sa/_sa.pxd
index f1cd8e29..2067e2b2 100644
--- a/python/cdec/sa/_sa.pxd
+++ b/python/cdec/sa/_sa.pxd
@@ -28,7 +28,9 @@ cdef class FeatureVector:
cdef class Phrase:
cdef int *syms
- cdef int n, *varpos, n_vars
+ cdef int n,
+ cdef int *varpos,
+ cdef n_vars
cdef public int chunkpos(self, int k)
cdef public int chunklen(self, int k)
diff --git a/python/cdec/sa/bilex.pxi b/python/cdec/sa/bilex.pxi
index 73ba99c1..457ccadd 100644
--- a/python/cdec/sa/bilex.pxi
+++ b/python/cdec/sa/bilex.pxi
@@ -71,9 +71,16 @@ cdef class BiLex:
cdef compute_from_data(self, SuffixArray fsa, DataArray eda, Alignment aa):
cdef int sent_id, num_links, l, i, j, f_i, e_j, I, J, V_E, V_F, num_pairs
- cdef int *fsent, *esent, *alignment, *links, *ealigned, *faligned
+ cdef int *fsent
+ cdef int *esent
+ cdef int *alignment
+ cdef int *links
+ cdef int *ealigned
+ cdef int *faligned
cdef _node** dict
- cdef int *fmargin, *emargin, *count
+ cdef int *fmargin
+ cdef int *emargin
+ cdef int *count
cdef int null_word
null_word = 0
diff --git a/python/cdec/sa/rule.pxi b/python/cdec/sa/rule.pxi
index 7fde3e06..af8fabea 100644
--- a/python/cdec/sa/rule.pxi
+++ b/python/cdec/sa/rule.pxi
@@ -154,6 +154,25 @@ cdef class Phrase:
property words:
def __get__(self):
return [sym_tostring(w) for w in self if not sym_isvar(w)]
+
+ def iterspans(self, nt_flag = False, to_str = True):
+ """iterate over (terminal and nonterminal) spans, it generates pairs of the kind (terminal span, !nt_flag) or (nonterminal, nt_flag)
+ Example: iterspans(False, False) --> ([-1], False), ([2,3], True), ([-1], False), ([4], True), ([-1], False)
+ for the sequence -1 2 3 -1 4 -1"""
+ span = []
+ cdef int i, s
+ get_sym = lambda sym : sym_tostring(sym) if to_str else lambda sym : sym
+ for i from 0 <= i < self.n:
+ s = self.syms[i]
+ if sym_isvar(s):
+ if len(span):
+ yield (span, not nt_flag)
+ span = []
+ yield ([get_sym(s)], nt_flag)
+ else:
+ span.append(get_sym(s))
+ if len(span):
+ yield (span, not nt_flag)
cdef class Rule:
diff --git a/python/cdec/sa/rulefactory.pxi b/python/cdec/sa/rulefactory.pxi
index 4f09218d..eba367f8 100644
--- a/python/cdec/sa/rulefactory.pxi
+++ b/python/cdec/sa/rulefactory.pxi
@@ -1370,8 +1370,12 @@ cdef class HieroCachingRuleFactory:
cdef extract_phrases(self, int e_low, int e_high, int* e_gap_low, int* e_gap_high, int* e_links_low, int num_gaps,
int f_low, int f_high, int* f_gap_low, int* f_gap_high, int* f_links_low,
int sent_id, int e_sent_len, int e_sent_start):
- cdef int i, j, k, m, n, *e_gap_order, e_x_low, e_x_high, e_x_gap_low, e_x_gap_high
- cdef int *e_gaps1, *e_gaps2, len1, len2, step, num_chunks
+ cdef int i, j, k, m, n
+ cdef int *e_gap_order
+ cdef int e_x_low, e_x_high, e_x_gap_low, e_x_gap_high
+ cdef int *e_gaps1
+ cdef int *e_gaps2
+ cdef int len1, len2, step, num_chunks
cdef IntList ephr_arr
cdef result
@@ -1487,8 +1491,16 @@ cdef class HieroCachingRuleFactory:
return ret
cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks):
- cdef int* sent_links, *e_links_low, *e_links_high, *f_links_low, *f_links_high
- cdef int *f_gap_low, *f_gap_high, *e_gap_low, *e_gap_high, num_gaps, gap_start
+ cdef int *sent_links
+ cdef int *e_links_low
+ cdef int *e_links_high
+ cdef int *f_links_low
+ cdef int *f_links_high
+ cdef int *f_gap_low
+ cdef int *f_gap_high
+ cdef int *e_gap_low
+ cdef int *e_gap_high
+ cdef int num_gaps, gap_start
cdef int i, j, k, e_i, f_i, num_links, num_aligned_chunks, met_constraints, x
cdef int f_low, f_high, e_low, e_high, f_back_low, f_back_high
cdef int e_sent_start, e_sent_end, f_sent_start, f_sent_end, e_sent_len, f_sent_len
diff --git a/training/crf/Makefile.am b/training/crf/Makefile.am
index cd82161f..87d9f838 100644
--- a/training/crf/Makefile.am
+++ b/training/crf/Makefile.am
@@ -9,27 +9,28 @@ bin_PROGRAMS = \
mpi_baum_welch
mpi_baum_welch_SOURCES = mpi_baum_welch.cc
-mpi_baum_welch_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_baum_welch_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_adagrad_optimize_SOURCES = mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h
-mpi_adagrad_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_adagrad_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_online_optimize_SOURCES = mpi_online_optimize.cc
-mpi_online_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_online_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_flex_optimize_SOURCES = mpi_flex_optimize.cc
-mpi_flex_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_flex_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_extract_reachable_SOURCES = mpi_extract_reachable.cc
-mpi_extract_reachable_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_extract_reachable_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_extract_features_SOURCES = mpi_extract_features.cc
-mpi_extract_features_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_extract_features_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_batch_optimize_SOURCES = mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h
-mpi_batch_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_batch_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
mpi_compute_cllh_SOURCES = mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h
-mpi_compute_cllh_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a -lz
+mpi_compute_cllh_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz
AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/training -I$(top_srcdir)/training/utils -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval
+
diff --git a/training/mira/ada_opt_sm.cc b/training/mira/ada_opt_sm.cc
index 18ddbf8f..e5d25401 100644
--- a/training/mira/ada_opt_sm.cc
+++ b/training/mira/ada_opt_sm.cc
@@ -1,6 +1,5 @@
#include "config.h"
-#include <boost/container/flat_map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/program_options.hpp>
#include <boost/program_options/variables_map.hpp>
diff --git a/training/utils/Makefile.am b/training/utils/Makefile.am
index 27c6e344..edaaf3d4 100644
--- a/training/utils/Makefile.am
+++ b/training/utils/Makefile.am
@@ -12,10 +12,12 @@ noinst_PROGRAMS = \
EXTRA_DIST = decode-and-evaluate.pl libcall.pl parallelize.pl
sentserver_SOURCES = sentserver.cc
-sentserver_LDFLAGS = -pthread
+sentserver_LDFLAGS = $(PTHREAD_LIBS)
+sentserver_CXXFLAGS = $(PTHREAD_CFLAGS)
sentclient_SOURCES = sentclient.cc
-sentclient_LDFLAGS = -pthread
+sentclient_LDFLAGS = $(PTHREAD_LIBS)
+sentclient_CXXFLAGS = $(PTHREAD_CFLAGS)
TESTS = lbfgs_test optimize_test
diff --git a/utils/alias_sampler.h b/utils/alias_sampler.h
index 81541f7a..0f9d3f6d 100644
--- a/utils/alias_sampler.h
+++ b/utils/alias_sampler.h
@@ -1,5 +1,5 @@
-#ifndef _ALIAS_SAMPLER_H_
-#define _ALIAS_SAMPLER_H_
+#ifndef ALIAS_SAMPLER_H_
+#define ALIAS_SAMPLER_H_
#include <vector>
#include <limits>
diff --git a/utils/alignment_io.h b/utils/alignment_io.h
index 63fb916b..ec70688e 100644
--- a/utils/alignment_io.h
+++ b/utils/alignment_io.h
@@ -1,5 +1,5 @@
-#ifndef _ALIGNMENT_IO_H_
-#define _ALIGNMENT_IO_H_
+#ifndef ALIGNMENT_IO_H_
+#define ALIGNMENT_IO_H_
#include <string>
#include <iostream>
diff --git a/utils/b64tools.h b/utils/b64tools.h
index c821fc8f..130a9102 100644
--- a/utils/b64tools.h
+++ b/utils/b64tools.h
@@ -1,5 +1,5 @@
-#ifndef _B64_TOOLS_H_
-#define _B64_TOOLS_H_
+#ifndef B64_TOOLS_H_
+#define B64_TOOLS_H_
namespace B64 {
bool b64decode(const unsigned char* data, const size_t insize, char* out, const size_t outsize);
diff --git a/utils/corpus_tools.h b/utils/corpus_tools.h
index f6699d87..3ccaf6ef 100644
--- a/utils/corpus_tools.h
+++ b/utils/corpus_tools.h
@@ -1,5 +1,5 @@
-#ifndef _CORPUS_TOOLS_H_
-#define _CORPUS_TOOLS_H_
+#ifndef CORPUS_TOOLS_H_
+#define CORPUS_TOOLS_H_
#include <string>
#include <set>
diff --git a/utils/exp_semiring.h b/utils/exp_semiring.h
index 26a22071..164286e3 100644
--- a/utils/exp_semiring.h
+++ b/utils/exp_semiring.h
@@ -1,5 +1,5 @@
-#ifndef _EXP_SEMIRING_H_
-#define _EXP_SEMIRING_H_
+#ifndef EXP_SEMIRING_H_
+#define EXP_SEMIRING_H_
#include <iostream>
#include "star.h"
diff --git a/utils/fast_sparse_vector.h b/utils/fast_sparse_vector.h
index 6e2a77cd..1e0ab428 100644
--- a/utils/fast_sparse_vector.h
+++ b/utils/fast_sparse_vector.h
@@ -1,5 +1,5 @@
-#ifndef _FAST_SPARSE_VECTOR_H_
-#define _FAST_SPARSE_VECTOR_H_
+#ifndef FAST_SPARSE_VECTOR_H_
+#define FAST_SPARSE_VECTOR_H_
// FastSparseVector<T> is a integer indexed unordered map that supports very fast
// (mathematical) vector operations when the sizes are very small, and reasonably
diff --git a/utils/fdict.h b/utils/fdict.h
index eb853fb2..94763890 100644
--- a/utils/fdict.h
+++ b/utils/fdict.h
@@ -1,5 +1,5 @@
-#ifndef _FDICT_H_
-#define _FDICT_H_
+#ifndef FDICT_H_
+#define FDICT_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/utils/feature_vector.h b/utils/feature_vector.h
index a7b61a66..bf77b5ac 100644
--- a/utils/feature_vector.h
+++ b/utils/feature_vector.h
@@ -1,5 +1,5 @@
-#ifndef _FEATURE_VECTOR_H_
-#define _FEATURE_VECTOR_H_
+#ifndef FEATURE_VECTOR_H_
+#define FEATURE_VECTOR_H_
#include <vector>
#include "sparse_vector.h"
diff --git a/utils/filelib.h b/utils/filelib.h
index 4fa69760..90620d05 100644
--- a/utils/filelib.h
+++ b/utils/filelib.h
@@ -1,5 +1,5 @@
-#ifndef _FILELIB_H_
-#define _FILELIB_H_
+#ifndef FILELIB_H_
+#define FILELIB_H_
#include <cassert>
#include <string>
diff --git a/utils/kernel_string_subseq.h b/utils/kernel_string_subseq.h
index 516e8b89..00ee7da7 100644
--- a/utils/kernel_string_subseq.h
+++ b/utils/kernel_string_subseq.h
@@ -1,5 +1,5 @@
-#ifndef _KERNEL_STRING_SUBSEQ_H_
-#define _KERNEL_STRING_SUBSEQ_H_
+#ifndef KERNEL_STRING_SUBSEQ_H_
+#define KERNEL_STRING_SUBSEQ_H_
#include <vector>
#include <cmath>
diff --git a/utils/m.h b/utils/m.h
index dc881b36..bd82c305 100644
--- a/utils/m.h
+++ b/utils/m.h
@@ -1,5 +1,5 @@
-#ifndef _M_H_
-#define _M_H_
+#ifndef M_H_HEADER_
+#define M_H_HEADER_
#include <cassert>
#include <cmath>
diff --git a/utils/murmur_hash3.h b/utils/murmur_hash3.h
index a125d775..e8a8b10b 100644
--- a/utils/murmur_hash3.h
+++ b/utils/murmur_hash3.h
@@ -2,8 +2,8 @@
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
-#ifndef _MURMURHASH3_H_
-#define _MURMURHASH3_H_
+#ifndef MURMURHASH3_H_
+#define MURMURHASH3_H_
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
diff --git a/utils/perfect_hash.h b/utils/perfect_hash.h
index 29ea48a9..8c12c9f0 100644
--- a/utils/perfect_hash.h
+++ b/utils/perfect_hash.h
@@ -1,5 +1,5 @@
-#ifndef _PERFECT_HASH_MAP_H_
-#define _PERFECT_HASH_MAP_H_
+#ifndef PERFECT_HASH_MAP_H_
+#define PERFECT_HASH_MAP_H_
#include <vector>
#include <boost/utility.hpp>
diff --git a/utils/prob.h b/utils/prob.h
index bc297870..32ba9a86 100644
--- a/utils/prob.h
+++ b/utils/prob.h
@@ -1,5 +1,5 @@
-#ifndef _PROB_H_
-#define _PROB_H_
+#ifndef PROB_H_
+#define PROB_H_
#include "logval.h"
diff --git a/utils/small_vector.h b/utils/small_vector.h
index 280ab72c..c8cbcb2c 100644
--- a/utils/small_vector.h
+++ b/utils/small_vector.h
@@ -1,5 +1,5 @@
-#ifndef _SMALL_VECTOR_H_
-#define _SMALL_VECTOR_H_
+#ifndef SMALL_VECTOR_H_
+#define SMALL_VECTOR_H_
/* REQUIRES that T is POD (can be memcpy). won't work (yet) due to union with SMALL_VECTOR_POD==0 - may be possible to handle movable types that have ctor/dtor, by using explicit allocation, ctor/dtor calls. but for now JUST USE THIS FOR no-meaningful ctor/dtor POD types.
diff --git a/utils/sparse_vector.h b/utils/sparse_vector.h
index 049151f7..13601376 100644
--- a/utils/sparse_vector.h
+++ b/utils/sparse_vector.h
@@ -1,5 +1,5 @@
-#ifndef _SPARSE_VECTOR_H_
-#define _SPARSE_VECTOR_H_
+#ifndef SPARSE_VECTOR_H_
+#define SPARSE_VECTOR_H_
#include "fast_sparse_vector.h"
#define SparseVector FastSparseVector
diff --git a/utils/star.h b/utils/star.h
index 21977dc9..01433d12 100644
--- a/utils/star.h
+++ b/utils/star.h
@@ -1,5 +1,5 @@
-#ifndef _STAR_H_
-#define _STAR_H_
+#ifndef STAR_H_
+#define STAR_H_
// star(x) computes the infinite sum x^0 + x^1 + x^2 + ...
diff --git a/utils/tdict.h b/utils/tdict.h
index bb19ecd5..eed33c3a 100644
--- a/utils/tdict.h
+++ b/utils/tdict.h
@@ -1,5 +1,5 @@
-#ifndef _TDICT_H_
-#define _TDICT_H_
+#ifndef TDICT_H_
+#define TDICT_H_
#include <string>
#include <vector>
diff --git a/utils/timing_stats.h b/utils/timing_stats.h
index 0a9f7656..69a1cf4b 100644
--- a/utils/timing_stats.h
+++ b/utils/timing_stats.h
@@ -1,5 +1,5 @@
-#ifndef _TIMING_STATS_H_
-#define _TIMING_STATS_H_
+#ifndef TIMING_STATS_H_
+#define TIMING_STATS_H_
#include <string>
#include <map>
diff --git a/utils/verbose.h b/utils/verbose.h
index 73476383..e39e23cb 100644
--- a/utils/verbose.h
+++ b/utils/verbose.h
@@ -1,5 +1,5 @@
-#ifndef _VERBOSE_H_
-#define _VERBOSE_H_
+#ifndef VERBOSE_H_
+#define VERBOSE_H_
extern bool SILENT;
diff --git a/utils/weights.cc b/utils/weights.cc
index 1f66c441..7d5d96d4 100644
--- a/utils/weights.cc
+++ b/utils/weights.cc
@@ -147,7 +147,7 @@ void Weights::ShowLargestFeatures(const vector<weight_t>& w) {
vector<int> fnums(w.size());
for (unsigned i = 0; i < w.size(); ++i)
fnums[i] = i;
- int nf = FD::NumFeats();
+ int nf = w.size();
if (nf > 10) nf = 10;
vector<int>::iterator mid = fnums.begin();
mid += nf;
diff --git a/utils/weights.h b/utils/weights.h
index 920fdd75..0bd4c2d9 100644
--- a/utils/weights.h
+++ b/utils/weights.h
@@ -1,5 +1,5 @@
-#ifndef _WEIGHTS_H_
-#define _WEIGHTS_H_
+#ifndef WEIGHTS_H_
+#define WEIGHTS_H_
#include <string>
#include <vector>
diff --git a/utils/wordid.h b/utils/wordid.h
index 714dcd0b..3aa6cc23 100644
--- a/utils/wordid.h
+++ b/utils/wordid.h
@@ -1,5 +1,5 @@
-#ifndef _WORD_ID_H_
-#define _WORD_ID_H_
+#ifndef WORD_ID_H_
+#define WORD_ID_H_
#include <limits>